问题描述
我理解声明函数定义背后的基本原理,例如
int main(){return 0; } / *空括号* /
已过时,但我无法找出为什么Dennis Ritchie鄙视他们
足以称他们为"。憎恶"评论和/或链接赞赏。
-
Christopher Benson-Manica |我*应该*知道我在说什么 - 如果我
ataru(at)cyberspace.org |不,我需要知道。火焰欢迎。
I understand the rationale behind declaring function definitions such as
int main() { return 0; } /* empty parentheses */
obsolete, but I haven''t been able to find out why Dennis Ritchie despised them
enough to call them an "abomination." Comments and/or links appreciated.
--
Christopher Benson-Manica | I *should* know what I''m talking about - if I
ataru(at)cyberspace.org | don''t, I need to know. Flames welcome.
推荐答案
IIRC,空的parens与以下相同:
int main(.. 。);
表示可变数量的参数。 VARARGS
是皮塔饼,并且有依赖于实现的问题。
如果你真的想要一个空的参数列表,
那么适当的声明是:
int main(无效);
我的大脑对此很模糊,所以如果我做了一个boo-boo
在这里,请更正我。
IIRC, the empty parens is the same as:
int main(...);
which means variable number of arguments. VARARGS
are pita, and have implementation-dependent issues.
If you really want an empty parameter list,
then the proper declaration is:
int main(void);
My brain is fuzzy on this, so if I made a boo-boo
here, please correct me.
IIRC,空的parens与以下相同:
int main(...);
IIRC, the empty parens is the same as:
int main(...);
不,它不是。这意味着使用第一次遇到的用法来完成原型的
。
-
- 马克 - >
-
No, it doesn''t. It means use the first-encountered usage to complete
the prototype.
--
- Mark ->
--
请详细说明。
Dan
-
Dan Pop
DESY Zeuthen,RZ集团
电子邮件:
这篇关于空括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!