On 10 Sep 2002, Alexandre Julliard wrote: [...]
PS. I can't understand why GNU C doesn't support it, it can't be that difficult to implement can it?
Probably because it makes little sense on i386. I guess it might be supported on other CPUs.
It does make sense on recent x86 processors, i.e. I think on anything from a Pentium and up. the reason is that these processors have a 64bit bus and thus accessing a 64bit value which is not 64bit aligned is slower because it requires two memory accesses.
At least that's what a Byte article claimed when Byt still existed as a magazine. They had found that MSVC's malloc of the time only returned a 32bit aligned pointer which caused a significant performance drop half the time when accessing a big array of doubles. Their workaround was to allocate a bit more and align the pointer themselves.
I'm not entirely sure how this plays over with the recent crop of CPUs that have 128 or even 256bit internal interfaces to their first level cache, and then 32byte cache lines, etc. But a 32byte pragma pack certainly seems excessive :-)
Anyway, that's why 8bytes is the default Visual C++ alignment when placing variables on the stack, retuning mallcated pointers and maybe even structure fields.
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ f u kn rd ts, ur wy 2 gky 4 ur wn gd.