11.1.7 The bool type
The bool type represents boolean logical quantities. The possible values of
type bool are true and false.
No standard conversions exist between bool and other types. In particular,
the bool type is distinct and
separate from the integral types, and a bool value cannot be used in place
of an integral value, and vice
versa.
[Note: In the C and C++ languages, a zero integral or floating-point value,
or a null pointer can be converted
to the boolean value false, and a non-zero integral or floating-point
value, or a non-null pointer can be
converted to the boolean value true. In C#, such conversions are
accomplished by explicitly comparing an
integral or floating-point value to zero, or by explicitly comparing an
object reference to null. end note]
The bool type represents boolean logical quantities. The possible values of
type bool are true and false.
No standard conversions exist between bool and other types. In particular,
the bool type is distinct and
separate from the integral types, and a bool value cannot be used in place
of an integral value, and vice
versa.
[Note: In the C and C++ languages, a zero integral or floating-point value,
or a null pointer can be converted
to the boolean value false, and a non-zero integral or floating-point
value, or a non-null pointer can be
converted to the boolean value true. In C#, such conversions are
accomplished by explicitly comparing an
integral or floating-point value to zero, or by explicitly comparing an
object reference to null. end note]
博客介绍了bool类型,它代表布尔逻辑量,值为true和false,与其他类型无标准转换,和整数类型不同,bool值与整数值不能互换。还提及在C、C++和C#中,不同类型与bool类型转换的方式。
954

被折叠的 条评论
为什么被折叠?



