Possible Duplicate:
Is sizeof(bool) implementation defined in C++?
Im writing code that is compiled in vc++ with a g++ lib (libpng) and need to know if bool is the same size and bits in g++ and vc++. All I know is false is all 0’s and that sizeof(bool) is 1 in vc++
There are versions of
g++(and versions of Visual C++ as well for that matter) for which on some platformssizeof(bool)is not equal to 1. So no, you can’t assume that it will be the same on g++ and Visual C++. You can’t even assume that it’s the same on different versions of the same compiler or the same version on different platforms.