This is the mail archive of the
mailing list for the GCC project.
Re: Does malloc tell us anything about alignment modulo k?
On Jul 15, 2004, at 08:43, Jakub Jelinek wrote:
Yeah, on i386-linux, M$ Win too (but not sure what cygwin/mingw malloc
and ppc-linux at least this assumption is not true.
Safer would be MIN (BIGGEST_ALIGNMENT, 2 * BITS_PER_WORD).
We're having a lot of trouble with this for Ada as well.
Probably there should be a separate MALLOC_ALIGNMENT definition
The other problem is that when you know you need memory that is
more aligned than what malloc guarantees, you'll have to figure
out what routines are available for allocation, and how this
memory needs to be deallocated. Not all memaligns are compatible
with malloc's free() either, although I believe posix_memalign is.
It's a bit of a mess...