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
but g++ output is
$ g++ -o sizeof sizeof.c
沒有留言:
張貼留言