开发者

Default return value of a boolean type return function in c++ [duplicate]

开发者 https://www.devze.com 2023-04-07 04:39 出处:网络
This question already has answers here: 开发者_开发问答 Closed 11 years ago. Possible Duplicate: Why can you return from a non-void function without returning a value without producing a compil
This question already has answers here: 开发者_开发问答 Closed 11 years ago.

Possible Duplicate:

Why can you return from a non-void function without returning a value without producing a compiler error?

According to the c++ standard what should be the return value of the following function.

bool done()
{
     // no return value
}


This would be undefined behavior - anything can happen.


Although it returns a value, it is undefined.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号