ALERT

Cisco CloudCenter: Get the Hybrid IT Advantage

Compilation Unit

Definition - What does Compilation Unit mean?

A compilation unit refers to a C source code which is compiled and treated as a single logical unit. It is generally one or more complete files; however, it also may be a certain part of a file if the #ifdef preprocessor directive is applied to choose specific code sections.

Definitions and declarations within the compilation unit establish the scope of data objects.


Techopedia explains Compilation Unit

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

Compilation units are crucial to identify the scope of identifiers, and to determine the linkage of identifiers with other external and internal identifiers.

A compilation unit may relate to functions or data in other compilation units in the below given means:
  • A function in one compilation unit could very well call a function in a completely different compilation unit.
  • External linkage can be assigned to data objects to ensure that other compilation units can access them.
Programs comprised of more than a single compilation unit could be compiled individually, and then later linked to create the executable program. A legitimate C compilation unit includes no less than one external declaration.

This definition was written in the context of Programming
Share this: