Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
C preprocessor
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Other uses == Traditionally, the C preprocessor was a separate [[development tool]] from the compiler with which it is usually used. In that case, it can be used separately from the compiler. Notable examples include use with the (deprecated) [[imake]] system and for preprocessing [[Fortran]]. However, use as a [[general purpose preprocessor]] is limited since the source code language must be relatively C-like for the preprocessor to parse it.<ref name="gnu-cpp-overview"/> The [[GNU Fortran]] compiler runs "traditional mode" CPP before compiling Fortran code if certain file extensions are used.<ref>{{cite web|title=1.3 Preprocessing and conditional compilation|url=https://gcc.gnu.org/onlinedocs/gfortran/Preprocessing-and-conditional-compilation.html|publisher=GNU Project}}</ref> Intel offers a Fortran preprocessor, fpp, for use with the [[Intel Fortran Compiler|ifort]] compiler, which has similar capabilities.<ref>{{cite web|title=Using the fpp Preprocessor|url=https://software.intel.com/en-us/node/524749|publisher=Intel|access-date=14 October 2015}}</ref> CPP also works acceptably with most [[assembly language]]s and Algol-like languages. This requires that the language syntax not conflict with CPP syntax, which means no lines starting with <code>#</code> and that double quotes, which CPP interprets as [[string literal]]s and thus ignores, don't have syntactical meaning other than that. The "traditional mode" (acting like a pre-ISO C preprocessor) is generally more permissive and better suited for such use.<ref>{{cite web |title=Overview (The C Preprocessor) |url=https://gcc.gnu.org/onlinedocs/cpp/Overview.html |website=gcc.gnu.org |quote=Having said that, you can often get away with using cpp on things which are not C. Other Algol-ish programming languages are often safe (Ada, etc.) So is assembly, with caution. -traditional-cpp mode preserves more white space, and is otherwise more permissive. Many of the problems can be avoided by writing C or C++ style comments instead of native language comments, and keeping macros simple.}}</ref> Some modern compilers such as the [[GNU C Compiler]] provide preprocessing as a feature of the compiler; not as a separate tool.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)