This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
obstack default alignment
- From: Benno <benjl at cse dot unsw dot edu dot au>
- To: libc-alpha at sources dot redhat dot com
- Date: Tue, 10 Aug 2004 09:35:54 +1000
- Subject: obstack default alignment
There appears to be inconsistency in the alignment of memory returned
by different memory allocation routines in libc. Specifically malloc
is defined to allocate memory that is aligned to hold any data type.
(Which to me seems to be sane behaviour.)
By constrast obstack_alloc is defined to return memory aligned to 4 bytes.
*But* it actually calculates default alignmnet to be big enough to hold a
double (which is often the largest alignment needed, but not on Itanium).
I would have thought it made sense to set the default alignment in the same
way as malloc(). However failing shouldn't the code actually implement the
docs and set the alignment to 4, rather than calculating?
Cheers,
Benno