便携性和回报 [英] portability and return

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

问题描述

我听说返回-1不可移植。那么在这种情况下,可移植性的答案是什么?
?那么退出(0)和退出(-1)或退出(1)怎么样?

或者最好坚持使用C'的宏,因此:


退出(EXIT_FAILURE)

退出(EXIT_SUCCESS)


比尔

I have heard that return -1 is not portable. So what would be the answer
to portability in this case? What about exit(0) and exit (-1) or exit (1)?
Or would it be best to stick with C''s macros, hence:

exit(EXIT_FAILURE)
exit (EXIT_SUCCESS)

Bill

推荐答案

在文章< 2YnWj.20544
In article <2YnWj.20544


5b3.14006@trnddc05>,

Bill Cunningham< no **** @ nspam.comwrote :
5b3.14006@trnddc05>,
Bill Cunningham <no****@nspam.comwrote:

我听说返回-1不可移植。那么在这种情况下可移植性的答案是什么?退出(0)和退出(-1)或退出(1)怎么样?
或者最好坚持使用C'的宏,因此:
I have heard that return -1 is not portable. So what would be the answer
to portability in this case? What about exit(0) and exit (-1) or exit (1)?
Or would it be best to stick with C''s macros, hence:


>退出(EXIT_FAILURE)
退出(EXIT_SUCCESS)
>exit(EXIT_FAILURE)
exit (EXIT_SUCCESS)



最好坚持使用C'的宏。如果您使用除0或其中一个宏之外的任何值,则结果是实现



特别是,exit(1)是* not * C赋予的东西任何意义。

-

那么重要的是,评论家不应该拥有一个正确的抽象定义对于智力的美丽,但是某种气质,被美丽物体的存在深深感动的力量。&bbsp;            - Walter Pater

It would be best to stick with C''s macros. The results are implementation
defined if you use any value other than 0 or one of the macros.
In particular, exit(1) is *not* something that C assigns any meaning to.
--
"What is important, then, is not that the critic should possess a
correct abstract definition of beauty for the intellect, but a
certain kind of temperament, the power of being deeply moved by
the presence of beautiful objects." -- Walter Pater


Bill Cunningham写道:
Bill Cunningham wrote:

我听说返回-1不可移植。
I have heard that return -1 is not portable.



大概你在谈论main()的返回值?

Presumably you''re talking about the return value from main()?


那么在这种情况下是可移植性的答案吗?

退出(0)和退出(-1)或退出(1)怎么样?
So what would be the answer to portability in this case?
What about exit(0) and exit (-1) or exit (1)?



退出(0)没问题。

exit(0) is fine.


或者最好坚持使用C'' s宏,因此:


退出(EXIT_FAILURE)

退出(EXIT_SUCCESS)
Or would it be best to stick with C''s macros, hence:

exit(EXIT_FAILURE)
exit (EXIT_SUCCESS)



那些也很好。


-

彼得

Those are good too.

--
Peter


这篇关于便携性和回报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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