This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Does malloc tell us anything about alignment modulo k?


On Thu, 2004-07-15 at 08:35, Daniel Berlin wrote:
> I'm working on some trivial alignment analysis.
> Malloc'd memory is supposed to be "aligned suitably for any data type".
> Does this actually tell us anything about whether the result is aligned 
> modulo k (IE aligned to a k byte boundary)?
> 
> Some OS'en seem to have stricter guarantees (Darwin guarantees the 
> result of malloc is 16 byte aligned), i'm just trying to figure out 
> whether the general case tells us anything.
You can assume the return value from malloc is aligned to
BIGGEST_ALIGNMENT.  GCC has done this for some time.


jeff



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]