Possible Duplicate:
Can sizeof return 0 (zero)
Is there a legal way to define type with zero-size in C++?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
C++ Standard.
1.8.5.
Unless it is a bit-field (9.6), a most derived object shall have a non-zero size and shall occupy one or more
bytes of storage. Base class sub-objects may have zero size. An object of POD type (3.9) shall occupy
contiguous bytes of storage.
9.6.2.
A declaration for a bit-field that omits the identifier declares an unnamed bit-field. Unnamed bit-fields are
not members and cannot be initialized. As a special case, an unnamed bit-field with a width of zero specifies alignment
of the next bit-field at an allocation unit boundary. Only when declaring an unnamed bit-field may
the constant-expression be a value equal to zero.