Key Difference – CompileTime vs Runtime
Most programs are written using高级程序设计语言。These programming languages have a syntax similar to the English language. High-level languages are easily understandable by humans but they are not understandable by the computer. Therefore, the written program or thesource codeshould be converted into machine understandable format. It is called the machine code. The time period to convert the source code to machine code is known as compile time. Tasks such as syntax analysis, semantic analysis, and code generation occur at compile time. Time period to run the executable file generated at compile time is referred as runtime. Both are terms related to different program lifecycle phases. This article discusses the difference between compile time and runtime. Thekey differencebetween compile time and run time is that编译时间是将源代码转换为可执行文件的编程生命周期阶段,而运行时是指运行在编译时间生成的可执行文件的编程生命周期阶段。编译时发生的错误称为编译时间错误,并且在运行时发生错误称为exceptions。
内容
1.Overview and Key Difference
2.What is Compile Time
3.What is Runtime
4.Similarities Between Compile Time and Runtime
5.Side by Side Comparison – Compile Time vs Runtime in Tabular Form
6.概括
What is Compile Time?
程序员可以使用编程语言向计算机提供说明。程序员使用的大多数编程语言都是高级编程语言。他们的语法类似于英语。这些语言很容易被人类阅读和理解。使用高级语言编写的程序称为源代码。源代码可以根据任务包含一组线或许多行。计算机无法理解使用高级语言提供的说明。计算机了解机器代码。因此,必须将源代码编译到计算机代码中,以作为可执行程序。编程生命周期阶段称为编译时间。 It is the time period to complete the compilation process. The operations at compile time include syntax analysis, semantic analysis, and code generation.
During compilation, errors can occur. They occur due to syntax and semantic errors. These errors avoid successful compilation. The编译器指示编译时间错误。它将显示一条消息,以了解发生错误的行。一些常见的编译时间错误是缺少卷曲括号,拼写错误标识符和拼写错误的关键字。当发生编译错误时,程序员应解决该错误。
什么是运行时?
The runtime is also known asexecution time。It is the time when a program is running in contrast to other program lifecycle phases such as compile time, load time, etc. When the compilation process is completed, it is run by the user. The time period to run the executable generated at compile time is referred as runtime. The term runtime can be used to refer errors. Even the program is compiler properly, there can be errors.
这些错误不会给出预期的输出。它还可以终止程序的执行。这些错误在运行时发生,因此它们被称为运行时错误或异常。当数组不绑定并用完内存时,某些运行时错误将数字除以零。
What is the Similarity Between Compile Time and Runtime?
- 编译时间和运行时都是程序生命周期阶段。
What is the Difference Between Compile Time and Runtime?
Compile Time vs Runtime |
|
编译时间是将源代码转换为可执行文件的编程生命周期阶段。 | Runtime is the time when a program is running, in contrast to other program lifecycle phases such as compile time, link time, and load time. |
Errors | |
Compile time errors are syntax and semantic errors. | Runtime errors are known as exceptions. |
概括– CompileTime vs Runtime
Compile time and runtime are two phases of programming lifecycle. This article discussed the difference between compile time and runtime. Converting the programmer’s source code into machine code occurs at compile time. Running the executable file generated at compile time is referred as runtime. When there is an error at compile time, the compiler displays a message according to the error. Even the program compiled, it might not give the expected output. In that case, it is a runtime error or an exception. The difference between compile time and run time is that compile time is the programming life cycle phase that converts the source code into an executable file while runtime refers to the programming life cycle phase that runs the executables generated at compile time.
Reference:
1.“Compile time.”维基百科, Wikimedia Foundation, 16 Dec. 2017.Available here
2.“Run time (Program lifecycle phase).”维基百科,Wikimedia Foundation,2018年2月18日。Available here
Елеонора Литвинова说
谢谢!