Compilation unit

What is compilation unit?
A compilation unit refers to C source code that is compiled and treated as a single logical unit. It is generally one or more complete files; However, it can also be a specific part of a file if the #ifdef preprocessor directive is used to select specific sections of code.

Definitions and declarations within the translation unit determine the scope of data objects.

The compilation unit contains the files included as part of the #include preprocessor directive. However, it does not include the source lines that are skipped due to the conditional inclusion preprocessor directives.

Compilation units are crucial in order to identify the scope of the identifiers and to determine the association of the identifiers with other external and internal identifiers.

A compilation unit can refer to functions or data in other compilation units in the following means:

A function in one translation unit could very well call a function in a completely different translation unit.

An external link can be assigned to data objects to ensure that they can be accessed by other compilation units.
Programs that consist of more than one compilation unit can be compiled individually and later linked to create the executable program. A legitimate C compilation unit contains nothing less than an external declaration.

Was the explanation to "Compilation unit"Helpful? Rate now:

Further explanations for the initial letter C