With the code:
#include
class A {};
class B { char x; };
int main()
{
std::cerr << sizeof(A) << \" \" << sizeof(B) &
There is no requirement in the C++ standard that an empty object should have one byte of memory occupied. It is purely based on the implementation.
EDIT: true, it's conforming ( ISO/IEC 14882 p.149 ):
9 Classes [class]
..
..
..
3 Complete objects and member subobjects of class type shall have nonzero size ...