Re: [GD-Windows] using typedef to create aligned types
Brought to you by:
vexxed72
From: Daniel G. <dgl...@cr...> - 2004-12-09 22:57:52
|
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' |