Return value from local scope?

后端 未结 6 1013
终归单人心
终归单人心 2021-01-05 11:06

Bumped into some code like this in our code base... which made me worried.

int foo(int a); // Forward declaration.

int baz() {
    int result = {
         i         


        
6条回答
  •  时光说笑
    2021-01-05 11:25

    Because it's a non-pointer simple type, the exact value will be returned and so the return behavior is defined. That block is... really strange though, and I'm surprised there's a C compiler that won't choke on it out there.

提交回复
热议问题