6.1.2 Input File Types
The compilation driver distinguishes source files, intermediate files and library files solely by the file type, or extension. It recognizes the following file extensions, which are case-sensitive.
Extensions | Definition |
---|---|
file.c |
A C source file that must be preprocessed. |
file.h |
A header file (not to be compiled or linked). |
file.i |
A C source file that should not be preprocessed. |
file.o |
An object file. |
file.p |
A pre procedural-abstraction assembly language file. |
file.s |
Assembler code. |
file.S |
Assembler code that must be preprocessed. |
other | A file to be passed to the linker. |
There are no compiler restrictions imposed on the names of source files, but be aware of case, name-length and other restrictions imposed by your operating system. If you are using an IDE, avoid assembly source files whose basename is the same as the basename of any project in which the file is used. This may result in the source file being overwritten by a temporary file during the build process.
The terms “source file” and “module” are often used when talking about computer programs. They are often used interchangeably, but they refer to the source code at different points in the compilation sequence.
A source file is a file that contains all or part of a program. Source files are initially passed to the preprocessor by the driver.
A module is the output of the preprocessor, for a given source file, after
inclusion of any header files (or other source files) which are specified by
#include
preprocessor directives. These modules are then passed to the
remainder of the compiler applications. Thus, a module may consist of several source and
header files. A module is also often referred to as a translation unit. These terms can
also be applied to assembly files, as they too can include other header and source
files.