Re: using typedef to create aligned types
Daniel Glastonbury <[email protected]> Fri, 10 Dec 2004 09:00:40 +1000
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Organization | The Creative Assembly |
| Message-ID | <[email protected]> |
Javier Arevalo wrote: > Also my understanding is that sizeof(*p) = (char*)(p+1) - (char*)(p) > by definition, so a class with an int is sizeof 4 and a class with an > int and an alignment of 16 must be sizeof 16. > > Save typos, that should give an idea of what's going on. Well then in the typedef __declspec(align(16)) Fred AlignedFred, VC 7.1 is broken. It passes through a size of 40 bytes for a new AlignedFred[10]. Contrast with class __declspec(align(16)) AlignedFred, new AlignedFred[10] passes in a size of 160 bytes. Last time I looked at the implementation for operator new in the CRT it called malloc. I don't see how the declspec is being honoured in such a case. cheers DanG -- Dan Glastonbury, Senior Programmer, The Creative Assembly PO Box 883 Fortitude Valley, QLD, Australia. 4006 T: +617 3252 1359 W: http://www.creative-assembly.com.au `Pour encourjay lays ortras' ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Gamedevlists-windows mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555