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

后端 未结 5 1198
暖寄归人
暖寄归人 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条回答
  •  猫巷女王i
    2020-12-10 11:38

    The result of overwriting memory location used by v is undefined behaviour. Everything may happen, according to the standard (including your computer flying off and eating your breakfast).

提交回复
热议问题