首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

C++有没有规定bool门类的大小

2012-09-06 
C++有没有规定bool类型的大小C++有没有规定bool类型的大小[解决办法]The sizeof operator yields the numb

C++有没有规定bool类型的大小
C++有没有规定bool类型的大小

[解决办法]
The sizeof operator yields the number of bytes in the object representation of its operand. The operand
is either an expression, which is not evaluated, or a parenthesized type-id. The sizeof operator shall not
be applied to an expression that has function or incomplete type, or to an enumeration type before all its
enumerators have been declared, or to the parenthesized name of such types, or to an lvalue that designates
a bit-field. sizeof(char), sizeof(signed char) and sizeof(unsigned char) are 1; the
result of sizeof applied to any other fundamental type (3.9.1) is implementation-defined. [Note: in particular,
sizeof(bool) and sizeof(wchar_t) are implementation-defined.69) ] [Note: See 1.7 for
the definition of byte and 3.9 for the definition of object representation. ]


__________________
69)
sizeof(bool) is not required to be 1.
70) The actual size of a base class subobject may be less than the result of applying sizeof to the subobject, due to virtual base
classes and less strict padding requirements on base class subobjects.

热点排行