How to hint to GCC that a line should be unreachable at compile time?

前端 未结 4 440
渐次进展
渐次进展 2021-01-04 03:20

It\'s common for compilers to provide a switch to warn when code is unreachable. I\'ve also seen macros for some libraries, that provide assertions for unreachable code.

4条回答
  •  暖寄归人
    2021-01-04 03:59

    gcc 4.5 supports the __builtin_unreachable() compiler inline, combining this with -Wunreachable-code might do what you want, but will probably cause spurious warnings

提交回复
热议问题