sizeof trap
see more detail in jesrv blog http://blog.linux.org.tw/~jserv/archives/001876.html A class with an empty sequence of members and base class objects is an empty class. Complete objects and member subobjects of an empty class type shall have nonzero size. #include <stdio.h> int main() { printf("%d, %d\n", sizeof('J'), sizeof(char)); return 0; } gcc output is $ gcc -o sizeof sizeof.c $ ./sizeof 4, 1 but g++ output is $ g++ -o sizeof sizeof.c $ ./sizeof 1, 1 because 'j' default is integer in c, is char in c++