在执行主要方法 [英] Execution at main method
问题描述
斐伊川,
我们通常看到程序执行像C,C ++,Java的语言的主要方法开始(我所熟悉的这些)。我想知道编译器如何知道主
在程序方法presence。
We generally see that the program execution begins in the main method for the languages like C , C++ , Java (i am familiar with these). I want to know how the compiler knows the presence of MAIN
method in the program .
什么是主
方法表示,除了这是执行程序的入口点......如何这些标准的差异,C,C ++ ...
What does the main
method signify besides that it is the entry point for program execution ...How does these criteria differ for C , C++ ...
提供您认为有帮助...
Provide any links which you think are helpful ...
推荐答案
通常,在每个C或C ++程序开始执行code(包括通常由编译器/链接默认)做了一些初始化和然后调用一个名为主要功能
。如果该函数不present,它将链接的程序(其中所有的名字必须解决)时导致一个悬而未决的名称。如果是present,它会被程序初始化code被调用。
Generally, the code that is executed at the beginning of every C or C++ program (included usually by default by compilers/linkers) does some initialization and then calls a function called main
. If this function is not present, it will lead to an unresolved name when linking a program (in which all the names have to be resolved). If it is present, it will be called by the program initialization code.
初始化code做一些家务(例如,转换的主要功能为程序的退出code中的返回值,等等。)
The initialization code does some housekeeping (for example, converts the return value of the main function to the exit code of the program, etc.)
这篇关于在执行主要方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!