Home > Back-end >  How many translation units in one module?
How many translation units in one module?

Time:12-14

Does a module with multiple source files (.cpp) have one or multiple translation units? My understanding is that every single source file (.cpp) will be its own translation unit unless it is included, and #pragma onced (which I guess is a malpractice), but I don't know how that is done in a modular program. If there's any difference, then I am particularly interested in Visual Studio C development (post C 2020)

CodePudding user response:

A module consists of one or more translation units. A translation unit that starts with a module declaration is termed a module unit, and if there are multiple module units in a program that have the same module name (ignoring any module partition) then they belong to the same module.

  • Related