Returning From a Void Function in C++

前端 未结 7 1050
再見小時候
再見小時候 2020-12-31 11:21

Consider the following snippet:

void Foo()
{
  // ...
}

void Bar()
{
  return Foo();
}

What is a legitimate reason to use the above in C++

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-31 11:57

    The only reason I can think of is if you had a long list of return Foo(); statements in a switch and wanted to make it more compact.

提交回复
热议问题