Compile time& link time&run time

来源:互联网 发布:免费域名x 编辑:程序博客网 时间:2024/05/21 22:22

虽然在学校里面的时候,就知道编译  连接  运行 ,但是真的在这几个阶段做了什么,还真是答不上来。

  • Compile time
  • http://en.wikipedia.org/wiki/Compile_tim
  • Link time
  • http://en.wikipedia.org/wiki/Link_time
  • Run time (program lifecycle phase)
  • http://en.wikipedia.org/wiki/Run_time_(program_lifecycle_phase)


Compile time

From Wikipedia, the free encyclopedia
Question book-new.svg
This article does not cite any references or sourcesPlease help improve this article byadding citations to reliable sources. Unsourced material may be challenged andremoved. (December 2009)

In computer science, compile time refers to either the operations performed by a compiler (the "compile-time operations"),programming language requirements that must be met by source code for it to be successfully compiled (the "compile-time requirements"), or properties of the program that can be reasoned about at compile time.

The operations performed at compile time usually include syntax analysis, various kinds of semantic analysis (e.g., type checks andinstantiation of template) and code generation.

Programming language definitions usually specify compile time requirements that source code must meet to be successfully compiled. For example, that the amount of storage required by types and variable can be deduced.

Properties of a program that can be reasoned about at compile time include range-checks (e.g., proving that an array index will not exceed the array bound), deadlock freedom in concurrent languages, or timings (e.g., proving that a sequence of code takes no more than an allocated amount of time).

Compile time occurs before link time (when the output of one or more compiled files are joined together) and runtime (when aprogram is executed). In some programming languages it may be necessary for some compilation and linking to occur at runtime. There is a trade-off between compile-time and link-time in that many compile time operations can be deferred to link-time without incurring extra run-time.

"Compile time" can also refer to the amount of time required for compilation.

Link time

From Wikipedia, the free encyclopedia
Question book-new.svg
This article does not cite any references or sourcesPlease help improve this article byadding citations to reliable sources. Unsourced material may be challenged andremoved. (December 2006)
This article may require cleanup to meet Wikipedia's quality standardsNo cleanup reasonhas been specified. Please help improve this article if you can. (March 2009)

In computer science, link time refers to either the operations performed by a linker (i.e. link time operations) or programming language requirements that must be met by compiled source code for it to be successfully linked (i.e. link time requirements).

The operations performed at link time usually include fixing up the addresses of externally referenced objects and functions, various kinds of cross module checks (e.g. type checks on externally visible identifiers and in some languages instantiation of template). Some optimizing compilers delay code generation until link time because it is here that information about a complete program is available to them.

The definition of a programming language may specify link time requirements that source code must meet to be successfully compiled (e.g. the maximum number of characters in an externally visible identifier that must be considered significant).

Link time occurs after compile time and before runtime (when a program is executed). In some programming languages it may be necessary for some compilation and linking to occur at runtime. Resolving external variables in a program is done at link time.





Run time (program lifecycle phase)

From Wikipedia, the free encyclopedia
Question book-new.svg
This article does not cite any references or sourcesPlease help improve this article byadding citations to reliable sources. Unsourced material may be challenged andremoved. (May 2012)

In computer science, run timerun-timeruntime, or execution time is the time during which a program is running (executing), in contrast to other phases of a program's lifecycle such as compile time, link time, load time, etc.

A run-time error is detected after or during the execution of a program, whereas a compile-time error is detected by the compilerbefore the program is ever executed. Type checking, storage allocation, code generation, and code optimization are typically done at compile time, but may be done at run time depending on the particular language and compiler.

Contents

  [hide] 
  • 1 Implementation details
  • 2 Application errors — exceptions
  • 3 See also
  • 4 References

Implementation details[edit source | editbeta]

In certain cases, the execution of a program begins after a loader performs the necessary memory setup and links the program with any dynamically linked libraries it needs. In some cases a language or implementation will have these tasks done by the language runtime instead, though this is unusual in mainstream languages on common consumer operating systems.

Some program debugging can only be performed (or is more efficient or accurate) when performed at runtime. Logic errors andarray bounds checking are examples. For this reason, some programming bugs are not discovered until the program is tested in a "live" environment with real data, despite sophisticated compile-time checking and pre-release testing. In this case, the end user may encounter a runtime error message.

Application errors — exceptions[edit source | editbeta]

Exception handling is one language feature designed to handle runtime errors, providing a structured way to catch completely unexpected situations as well as predictable errors or unusual results without the amount of inline error checking required of languages without it. More recent advancements in runtime engines enable automated exception handling which provides 'root-cause' debug information for every exception of interest and is implemented independent of the source code, by attaching a special software product to the runtime engine.

Look up run timerun-time, orruntime in Wiktionary, the free dictionary.

See also[edit source | editbeta]

  • Name binding
  • Compile time and compiling
  • Interpreter (computing)
  • Runtime Type Information
  • Run-time system
  • Runtime library


原创粉丝点击