Returning From a Void Function in C++

前端 未结 7 1052
再見小時候
再見小時候 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:46

    The reason is returning memory like math.h always returns. math.h has no void and no empty arguments. There are many practical situations where you need memory.

提交回复
热议问题