Makes no difference.
Its gcc 4.1.0. Perhaps it is a bug but it seems a pretty fundamental
one.
Why would it be non zero if theres nothing in it? Surely the whole
point of sizeof is to return the size in bytes of the members inside?
If there are no members it should be zero bytes surely? 1 makes no
sense to me.
No, sizeof() tells you how much less free memory you will have after
creating an instance of the type. Since all objects (and ints, doubles,
etc. counts as objects in this) in both C and C++ must have an address
and no two objects are allowed to share the same address (except perhaps
when using union) an object must take at least one byte.
Another example demonstrating that the size of not the sum of the sizes
of the members is the following:
struct Test
{
char c;
int i;
};
On my machine sizeof(Test) is 8, since the integer is 4-byte aligned 3
padding bytes will be inserted between the char and the int.