c ++中布尔类型返回函数的默认返回值 [英] Default return value of a boolean type return function in c++

查看:1720
本文介绍了c ++中布尔类型返回函数的默认返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:


根据c ++标准,应该是以下函数的返回值。

  bool done()
{
//无返回值
}


解决方案

这是未定义的行为 - 任何事情都可能发生。


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.

这篇关于c ++中布尔类型返回函数的默认返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆