How to do an explicit fall-through in C

后端 未结 3 1635
遇见更好的自我
遇见更好的自我 2021-01-03 22:45

The newer versions of gcc offer the Wimplicit-fallthrough, which is great to have for most switch statements. However, I have one switch statement where I want

3条回答
  •  离开以前
    2021-01-03 22:48

    You should be able to use GCC diagnostic pragmas to disable that particular warning for your source file or some portion of a source file. Try putting this at the top of your file:

    #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
    

提交回复
热议问题