main()是用户定义的函数吗? [英] Is main() a User-Defined Function?

查看:251
本文介绍了main()是用户定义的函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

程序员确实定义main()内部到底发生了什么.

The programmer does define what happens inside main(), after all.

那么,应该将其视为用户定义的功能吗?

So, should it be considered a user-defined function?

推荐答案

C ++标准没有用户定义函数的概念.相反,它具有库功能的概念. main不是库函数.但是,该标准还对其签名提出了一些要求,并且该标准不得重载或声明为静态或内联.特别是,不得使用,这意味着您无法调用它.

The C++ standard doesn't have the notion of user-defined functions. Instead, it has the notion of library functions. main is not a library function. However, the standard also imposes some requirements on its signature, and that it must not be overloaded or declared static or inline. In particular, it must not be used, meaning that you cannot call it.

编辑:我最初仅检查C标准.现在,我还检查了C ++标准,它在以下上下文中使用用户定义的":运算符,类型,转换和库.它还具有用户声明的名称空间,用户声明的(默认和副本)构造函数以及用户编写的默认构造函数.在27.1.1中确实具有用户功能".

Edit: I originally checked the C standard only. I have now checked the C++ standard as well, and it uses "user-defined" in the following contexts: operators, types, conversions, and libraries. It also has user-declared namespaces, user-declared (default and copy) constructors, and user-written default constructors. It does have "user functions" in 27.1.1.

这篇关于main()是用户定义的函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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