How can I tell gcc to warn (or fail) on switch/case statements without a break?

后端 未结 6 1339
有刺的猬
有刺的猬 2021-01-17 17:50

I have a complicated switch statement, and I forgot to put a break at the end of one of the cases. This is quite legal, and as a resu

6条回答
  •  悲&欢浪女
    2021-01-17 17:54

    Short answer is no, there is no such flag in gcc to do that. Switch case is used for the fall through more often so that is why it does not make sense to have such a flag in gcc.

提交回复
热议问题