C preprocessor: Difference between revisions

Content deleted Content added
Mudryyf (talk | contribs)
m Fix typo - "convension" to "convention
Line 120:
In this case, the file name is enclosed in angle brackets to denote that it is a system file. For a file in the [[codebase]] being [[software build|built]], double-quotes are used instead. The preprocessor may use a different search algorithm to find the file based on this distinction.
 
For C, a header file is usually named with a <code>.h</code> extension. In C++, the convensionconvention for file extension varies with common extensions <code>.h</code> and <code>.hpp</code>. But the preprocessor includes a file regardless of the extension. In fact, sometimes code includes <code>.c</code> or <code>.cpp</code> files.
 
To prevent including the same file multiple times which often leads to a compiler error, a header file typically contains an [[include guard]] or if supported by the preprocessor [[pragma once|<code>#pragma once</code>]] to prevent multiple inclusion.