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!
{{Short description|Text processor used with C and C++ and other programming tools}} {{Use dmy dates|date=June 2023}} {{multiple issues| {{how-to|date=February 2013}} {{more footnotes needed|date=March 2015}} }} The '''C preprocessor''' ('''CPP''') is a [[text file]] [[preprocessor|processor]] that is used with [[C (programming language)|C]], [[C++]] and other [[programming tool]]s. The preprocessor provides for file inclusion (often [[header files]]), [[macro (computer science)|macro]] expansion, [[conditional compilation]], and line control. Although named in association with C and used with C, the preprocessor capabilities are not inherently tied to the C language. It can and is used to process other kinds of files.<ref>[https://gist.github.com/djedr/7d21eac05ce2bbbca29b29d532a1fbe4 General-purpose text preprocessing with the C preprocessor. Featuring JavaScript]</ref> C, C++, and [[Objective-C]] compilers provide a preprocessor capability, as it is required by the definition of each language. Some compilers provide extensions and deviations from the target language standard. Some provide options to control standards compliance. For instance, the GNU C preprocessor can be made more standards compliant by supplying certain command-line flags.<ref name="gnu-cpp-overview"> {{cite web |title=The C Preprocessor: Overview |url=https://gcc.gnu.org/onlinedocs/cpp/Overview.html |access-date=17 July 2016 }}</ref> The [[C Sharp (programming language)|C#]] programming language also allows for directives, even though they cannot be used for creating macros, and is generally more intended for features such as conditional compilation.<ref>{{cite web|url=https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives|title=C# preprocessor directives|date=14 January 2022 |publisher=Microsoft}}</ref> C# seldom requires the use of the directives, for example code inclusion does not require a preprocessor at all (as C# relies on a package/namespace system like Java, no code needs to be "included"). The [[Haskell]] programming language also allows the usage of the C preprocessor, which is invoked by writing <syntaxhighlight lang="Haskell" inline>{-# LANGUAGE CPP #-}</syntaxhighlight> at the top of the file. The accepted preprocessor directives align with those in standard C/C++. Features of the preprocessor are encoded in [[source code]] as [[Directive (programming)|directives]] that start with <code>#</code>. Although C++ source files are often named with a <code>.cpp</code> extension, that is an abbreviation for "C plus plus"; not C preprocessor.
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)