Re: A debugging implementation of malloc
- From: "Dann Corbit" <dcorbit@xxxxxxxxx>
- Date: Mon, 17 Jul 2006 13:52:50 -0700
<ena8t8si@xxxxxxxxx> wrote in message
news:1153168957.503281.293600@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Chris Torek wrote:
Barry Schwarz wrote:
At this point [where r is the result of a malloc() call] r contains
the address of a block of memory properly aligned for any possible
object.
In article <4g5uc3F1m0bt2U1@xxxxxxxxxxxxxx>
Ian Collins <ian-news@xxxxxxxxxxx> wrote:
Is there a portable way of finding out what this alignment is?
No. I consider this a flaw in the C standards.
If there *were* a portable way to find this, you could write portable
"augmented malloc and free" routines along the lines of those Mr Navia
has provided (with more work to deal with alignment, of course). ...
I think you mean to add a qualifier that pointers
can be turned into integers and operated on sensibly.
Otherwise knowing the alignment doesn't help.
Dumb question:
If we have no guarantee of modular math on the pointers, then why not
repeated subtraction on the pointers (which is clearly guaranteed)?
.
- Prev by Date: Re: error: invalid operands to binary &
- Next by Date: Re: Help for designing outlines in c language
- Previous by thread: Help for designing outlines in c language
- Next by thread: convert int to string without using standard library (stdio.h)
- Index(es):
Relevant Pages
|