'break' statement when using curly braces in switch-case

后端 未结 5 1942
太阳男子
太阳男子 2020-12-30 18:49

I use curly braces with all of my switch case statements in C/Objective-C/C++

I had not, until a few moments ago, considered whether including the break;

5条回答
  •  一生所求
    2020-12-30 19:33

    You probably don't want the curlies in the first place unless you need them for lexical scope. The first example looks better to me, but I suppose the real answer is that it's a matter of taste.

提交回复
热议问题