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
但仍然发出警告,并在其他回复后修改为
but still warning is there ...I am not getting all the exact reason behind this ...
----; ----; line是一些功能...并且提到的代码是在C ++中
答案 0 :(得分:4)
什么是TRUE
?
尝试使用实际的布尔常量:
#define assert_always assert(false)
另请注意,assert(true)
永远不会断言,因为表达式(字面意思)为真。
答案 1 :(得分:0)
使用true C ++ bool类型:
assert(true)
而不是TRUE
但它不会做你想要的(总是断言)。断言(假)会。