Valid, but worthless syntax in switch-case?

后端 未结 8 1516
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-30 03:38

Through a little typo, I accidentally found this construct:

int main(void) {
    char foo = \'c\';

    switch(foo)
    {
        printf(\"Cant Touch This\\n\");         


        
8条回答
  •  轮回少年
    2021-01-30 04:06

    Assuming you are using gcc on Linux, it would have given you a warning if you're using 4.4 or earlier version.

    The -Wunreachable-code option was removed in gcc 4.4 onward.

提交回复
热议问题