主要的返回值范围 [英] main return value range

查看:138
本文介绍了主要的返回值范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是什么标准说一下主要的返回值范围是多少?

说仅达255?

由于

  INT主要(无效){
返回256;
}
回声$? ; #0出


解决方案

该标准不说了。 0,EXIT_SUCCESS和EXIT_FAILURE已经(在某种程度上)中规定的含义。还有什么依赖于实现。

在present时候,大多数基于Unix的系统只支持8位的返回值。 Windows支持(至少)一个32位的返回值。我还没有选中的64位Windows是否支持64位的返回值,但我相当怀疑,因为即使64位Windows通常仍然采用了32位int。

What does standard say about main return values range?

say only up to 255?

Because

int main(void){
return 256;
}
echo $? ;  # out 0

解决方案

The standard doesn't say. 0, EXIT_SUCCESS and EXIT_FAILURE have (sort of) specified meanings. Anything else depends on the implementation.

At the present time, most Unix-based systems only support 8-bit return values. Windows supports (at least) a 32-bit return value. I haven't checked whether 64-bit Windows supports a 64-bit return value, but I rather doubt it, since even 64-bit Windows normally still uses a 32-bit int.

这篇关于主要的返回值范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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