Engineered bool compares equal to both true and false, why?

后端 未结 5 1177
暖寄归人
暖寄归人 2020-12-10 11:04

The example bellows compiles, but the output is rather strange :

#include 
#include 

struct A
{
    int a;
    char b;
    bo         


        
5条回答
  •  有刺的猬
    2020-12-10 11:45

    A boolean value whose memory is set to a value that is not one or zero has undefined behaviour.

提交回复
热议问题