相关疑难解决方法(0)

What is the proper declaration of main?

What is the proper signature of the main function in C++? What is the correct return type, and what does it mean to return a value from main? What are the allowed parameter types, and what are their meanings?

这是系统特定的吗?这些规则会随着时间而改变吗?如果我违反它们会发生什么?

c++ program-entry-point c++-faq

144
推荐指数
2
解决办法
9万
查看次数

`f(void)`表示C++ 11或C中没有参数?

在C++ 11中,以下函数声明:

int f(void);
Run Code Online (Sandbox Code Playgroud)

意思是:

int f();
Run Code Online (Sandbox Code Playgroud)

由非依赖类型void的单个未命名参数组成的参数列表等效于空参数列表.

我得到(也许是错误的)印象这是一个旧功能,也许是从C继承而来的?

有没有人知道这种方式背后的历史或理由来声明一个没有参数的函数?

c c++ c++11

24
推荐指数
2
解决办法
1419
查看次数

标签 统计

c++ ×2

c ×1

c++-faq ×1

c++11 ×1

program-entry-point ×1