"Translation" vs. "Compilation" unit

Which is the correct term? I've seen both thrown around, but a couple times I see people correcting others who write "compilation unit."

Or are they two different things?
Same thing, I learned recently taking a casual read of the first chapter of the dragon book.

Well a compiler collects and compiles, object code into machine code, the construct that does this "translation" on the source to macchine is called the translation unit or translator. So a translation unit is a subset of a compilation unit which is loosely the same but not exactly.
Last edited on
The definition is pretty much unchanged across C and C++ language definitions:

C89 2.1.1.1
The text of the program is kept in units called source files in this Standard. A source file together with all the headers and source files included via the preprocessing directive #include , less any source lines
skipped by any of the conditional inclusion preprocessing directives, is called a translation unit


C++14 (CD n3690) 2.1[lex.separate]/1
The text of the program is kept in units called source files in this International Standard. A source file together with all the headers and source files included via the preprocessing directive #include, less any source lines skipped by any of the conditional inclusion preprocessing directives, is called a translation unit.


The term "compilation unit" is not used in C standards at all, and only appears in C++ in a couple places within the rationale for the breaking changes between C and C++, where it appears to mean the same thing as "translation unit".
Last edited on
Topic archived. No new replies allowed.