Return value from local scope?

后端 未结 6 1060
终归单人心
终归单人心 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:26

    It's not standard C++.

    In standard C++, write

    bool baz() { return !foo( dosomestuff() ); }
    

    That's it.

提交回复
热议问题