
On Wed, 10 Aug 2005 09:30:00 +0400, christopher diggins <cdiggins@videotron.ca> wrote: []
The question I have is whether in practice though are there are any compilers which have stricter alignment requirements on small types (<= sizeof(void*)) than a void pointer. In other words, is it possible with any known compiler to actually throw the runtime error ?
You can probably force do the same thing as malloc() from glibc does and use a default alignment of 8 for 32bit and 16 for 64bit platforms: Alignment: 2 * sizeof(size_t) (default) (i.e., 8 byte alignment with 4byte size_t). This suffices for nearly all current machines and C compilers. However, you can define MALLOC_ALIGNMENT to be wider than this if necessary. -- Maxim Yegorushkin