[英]Should gcc warn when an integral enum that evaluates to 0 is used as a pointer?
[英]How to warn when assigning or performing arithmetic with different enum types in GCC?
雖然我知道這是有效的C不能區分枚舉類型。
GCC確實有-Wenum-compare
(我正在使用)並按預期工作。
我嘗試使用-Wconversion
但這沒有任何區別。
賦值和算術運算符( +
/ -
/ &
/ |
...等)如何生成警告? (作業,或者......等)
{
enum Foo f = SOME_VALUE;
enum Bar b = SOME_OTHER_VALUE;
if (f != b) {
/* this warns! */
}
f = b; /* <-- how to warn about this? */
f |= b; /* .. and this? */
}
筆記:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.