gpt4 book ai didi

c++ - 警告 634 : Strong type mismatch (type 'bool' ) in equality or conditional

转载 作者:行者123 更新时间:2023-11-27 23:09:07 25 4
gpt4 key购买 nike

This is part of my code base 
I am rying to run the below code and getting the warning like below code:

#define assert_always() assert(TRUE)

base::derived(
uint8 id;
){
switch(id)
{
case one:
----;
break;
case two:
----;
break;
default:
assert_always();
break;
}
}

Warning 634: Strong type mismatch (type 'bool') in equality or conditional .......

The line number is pointing to `assert_always()` function call. Can you guide me to first to understand and then solve this warning?

I have checked by changing TRUE to true but stil having the same problem ...

Actually code was like this in c++ :
#define assert_always()

base::derived(
uint8 id;
){
switch(id)
{
case one:
----;
break;
case two:
----;
break;
default:
assert_always();
break;
}
}

I got the warning Warning 634: Strong type mismatch (type 'bool') in equality or conditional so I introduce

定义 assert_always() 断言(TRUE)

但还是有警告,在其他回复后,修改为

定义 assert_always() 断言(真)

but still warning is there ...I am not getting all the exact reason behind this ...

----;行是一些功能......并且提到的代码是在 C++ 中

最佳答案

什么是TRUE

用实际的 bool 常量试试:

#define assert_always assert(false)

另请注意,assert(true) 永远不会断言,因为表达式(字面上)为真。

关于c++ - 警告 634 : Strong type mismatch (type 'bool' ) in equality or conditional,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21285468/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com