This may not be a problem. If I'm not mistaken, the compiler will align the the structure so that it's size and address is a multiple of 2. It could just be that the compiler reports the size that will be allocated in memory, rather than it's declared size.
This is kind of implied in the GCC documentation in -Wabi and -Wcast-align .
If such is the case and you add -Wpadded to your compiler parameters, it should be reported.
The_Eu <th...@ig...> wrote:
FLAVOR00-NONE-0000-0000-000000000000;Hi!
I have a problem with "sizeof"!
look in this struct...
struct Face {
char numVert; ->1 byte
short unsigned int v1,v2,v3,v4; ->4*2 bytes = 8bytes
float nx,ny,nz; ->3*4bytes = 12bytes
short unsigned int matIndex; ->2bytes
};
The total is 23Bytes, but sizeof(Face) indicate 28bytes!!!
My declaration "short unsigned int", makes a "int" of 4 bytes, not 2 bytes!
<snip>
Alfred P. Reaud
|