111:
1893:, but it comes very close: recursive computations can be specified, but with a fixed upper bound on the amount of recursion performed. However, the C preprocessor is not designed to be, nor does it perform well as, a general-purpose programming language. As the C preprocessor does not have features of some other preprocessors, such as recursive macros, selective expansion according to quoting, and string evaluation in conditionals, it is very limited in comparison to a more general macro processor such as
2938:
424:. If the filename is enclosed within angle brackets, the file is searched for in the standard compiler include paths. If the filename is enclosed within double quotes, the search path is expanded to include the current source file directory. C compilers and programming environments all have a facility that allows the programmer to define where include files can be found. This can be introduced through a command-line flag, which can be parameterized using a
27:
68:
1653:) but without the square brackets. While all standard parameters require an argument to be passed to them (e.g., limit requires a width), this is generally optional and even the set of parentheses can be omitted if an argument is not required, which might be the case for some implementation-defined parameters.
733:
Whenever the identifier appears in the source code it is replaced with the replacement token list, which can be empty. For an identifier declared to be a function-like macro, it is only replaced when the following token is also a left parenthesis that begins the argument list of the macro invocation.
2304:
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
1665:
Implementations may provide their own extensions and deviations, and vary in their degree of compliance with written standards. Their exact behavior may depend on command-line flags supplied on invocation. For instance, the GNU C preprocessor can be made more standards compliant by supplying certain
1487:
A macro argument cannot be combined with additional text and then stringified. However, a series of adjacent string constants and stringified arguments can be written: the C compiler will then combine all the adjacent string constants into one long string.
712:
macro declaration must not have any whitespace between the identifier and the first, opening parenthesis. If whitespace is present, the macro will be interpreted as object-like with everything starting from the first parenthesis added to the token list.
1636:
parameter replaces the entire directive if the resource is empty (which happens if the file is empty or a limit of 0 is specified). All standard parameters can also be surrounded by double underscores, just like standard attributes on C23, for example
331:
Macro expansion and directive handling: Preprocessing directive lines, including file inclusion and conditional compilation, are executed. The preprocessor simultaneously expands macros and, since the 1999 version of the C standard, handles
1615:
or between quotes. The directive also allows certain parameters to be passed to it to customise its behaviour, which follow the file name. The C standard defines the following parameters and implementations may define their own. The
1661:
All C, C++, and
Objective-C implementations provide a preprocessor, as preprocessing is a required step for those languages, and its behavior is described by official standards for these languages, such as the ISO C standard.
1559:
directive for binary resource inclusion. This allows binary files (like images) to be included into the program without them being valid C source files (like XBM), without requiring processing by external tools like
813:. This is expanded in-place, so that repeated multiplication by the constant is not shown throughout the code. The macro here is written as all uppercase to emphasize that it is a macro, not a compiled function.
689:. Object-like macros do not take parameters; function-like macros do (although the list of parameters may be empty). The generic syntax for declaring an identifier as a macro of each type is, respectively:
1851:
As the C preprocessor can be invoked separately from the compiler with which it is supplied, it can be used separately, on different languages. Notable examples include its use in the now-deprecated
1720:
Many implementations (such as the C compilers by GNU, Intel, Microsoft and IBM) provide a non-standard directive to print out a warning message in the output, but not stop the compilation process (
1359:, which lists "various pre-defined compiler macros that can be used to identify standards, compilers, operating systems, hardware architectures, and even basic run-time libraries at compile-time."
1867:
compiler automatically calls "traditional mode" (see below) cpp before compiling
Fortran code if certain file extensions are used. Intel offers a Fortran preprocessor, fpp, for use with the
2440:: lists "various pre-defined compiler macros that can be used to identify standards, compilers, operating systems, hardware architectures, and even basic run-time libraries at compile-time"
1886:
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.
245:
2321:
1632:
parameters allow the programmer to specify a prefix and suffix to the embedded data, which is used if and only if the embedded resource is not empty. Finally, the
755:
qualifier to a global variable. This causes the value to be stored in memory, instead of being substituted by the preprocessor. However, in modern C++ code, the
1785:
There are some preprocessor directives that have been added to the C preprocessor by the specifications of some languages and are specific to said languages.
1576:
the directive is replaced by a comma separated list of integers corresponding to the data of the specified resource. More precisely, if an array of type
751:
numbers throughout the code. An alternative in both C and C++, especially in situations in which a pointer to the number is required, is to apply the
1352:. This file contains a list of similar macro calls, which can be referred to as "component macros." The include file is then referenced repeatedly.
2465:
1355:
Many compilers define additional, non-standard macros, although these are often poorly documented. A common reference for these macros is the
988:
Stringification operations are replaced with the textual representation of their argument's replacement list (without performing expansion).
1161:, preceded by the file and line number to the error stream, allowing quick access to which line the message was produced on. Note that the
1686:
is often used to allow suppression of specific error messages, manage heap and stack debugging and so on. A compiler with support for the
2162:
2113:
1286:
defined as a numeric literal specifying the version of the
Standard supported by the implementation. Standard C++ compilers support the
737:
Object-like macros were conventionally used as part of good programming practice to create symbolic names for constants; for example:
1274:. This allows source code debugging when C is used as the target language of a compiler, for a totally different language. The first
1878:
and Algol-like languages. This requires that the language syntax not conflict with CPP syntax, which means no lines starting with
994:
Concatenation operations are replaced with the concatenated result of the two operands (without expanding the resulting token).
1327:. Variadic macros are particularly useful when writing wrappers to functions taking a variable number of parameters, such as
559:. This allows code, including preprocessor commands, to compile only when targeting Windows systems. A few compilers define
2974:
2458:
2000:
1600:
is also easier for compilers to handle, since they are allowed to skip expanding the directive to its full form due to the
1099:, predefined by the preprocessor itself, which expand into the current file and line number. For instance, the following:
2378:
2259:
1290:
macro. Compilers running in non-standard mode must not set these macros or must define others to signal the differences.
2778:
2228:
1620:
parameter is used to limit the width of the included data. It is mostly intended to be used with "infinite" files like
271:
The C preprocessor was part of a long macro-language tradition at Bell Labs, which was started by
Douglas Eastwood and
78:
2969:
2964:
2942:
2394:
172:
154:
132:
54:
443:
extension may denote files designed to be included multiple times, each time expanding the same repetitive content;
125:
1312:, which contains the name of the function definition within which it is contained, but because the preprocessor is
1066:// HI_THERE, because the tokens originating from parameters ("HE" and "LLO") are expanded first
2759:
2668:
2451:
40:
2877:
428:, so that a different set of include files can be swapped in for different operating systems, for instance.
2897:
2849:
1860:
1734:
to the standard for this purpose). A typical use is to warn about the usage of some old code, which is now
2907:
2892:
2598:
2245:
1846:
2854:
2583:
1441:
If stringification of the expansion of a macro argument is desired, two levels of macros must be used:
2025:
Wirzenius, Lars. C "Preprocessor Trick For
Implementing Similar Data Types". Retrieved January 9, 2011
1316:
to the grammar of C, this must be done in the compiler itself using a variable local to the function.
2902:
2608:
2505:
2500:
2495:
1721:
1552:
296:
2091:
1128:#define DEBUGPRINT(_fmt, ...) fprintf(stderr, ": " _fmt, __FILE__, __LINE__, __VA_ARGS__)
1091:
Certain symbols are required to be defined by an implementation during preprocessing. These include
2882:
2593:
2541:
2474:
218:
198:
119:
1282:
be defined to 1 if the implementation conforms to the ISO Standard and 0 otherwise, and the macro
2745:
2720:
2179:
1940:
507:
229:
222:
1709:, which are used to control the floating-point implementation. The alternative, macro-like form
2763:
2705:
2432:
2305:
writing C or C++ style comments instead of native language comments, and keeping macros simple.
1916:
1894:
1868:
232:
is only weakly related to the grammar of C, and so is sometimes used to process other kinds of
136:
2106:"WG14-N3017 : #embed โ a scannable, tooling-friendly binary resource inclusion mechanism"
639:#if !(defined __LP64__ || defined __LLP64__) || defined _WIN32 && !defined _WIN64
2421:
2151:
2105:
2078:
1800:
but only includes the file once. A common vendor pragma with a similar functionality in C is
1766:
734:
The exact procedure followed for expansion of function-like macros with arguments is subtle.
2195:
2725:
1323:) are not allowed in C89, but were introduced by a number of compilers and standardized in
901:
Similarly, the outer pair of parentheses maintain correct order of operation. For example,
325:
268:
and then by John Reiser, to incorporate macros with arguments and conditional compilation.
194:
2207:
2063:
8:
2740:
2735:
2697:
2588:
1890:
1817:
1500:
operator (known as the "Token
Pasting Operator") concatenates two tokens into one token.
823:
46:
1980:
248:
and also in recognition of the usefulness of the file inclusion mechanisms available in
85:
2806:
2571:
2536:
2417:
1679:
1181:
directive determines the line number and the file name of the line below. For example:
256:. Its original version offered only file inclusion and simple string replacement using
809:-to-degrees conversion which can be inserted in the code where required; for example,
2639:
2634:
2603:
2546:
2390:
1921:
1875:
552:
1994:"General Constant Expressions for System Programming Languages, Proceedings SAC '10"
1584:
directive, the result is the same as-if the resource was written to the array using
2382:
2355:
2295:
2130:
1765:
preprocessors traditionally provided "assertions," which have little similarity to
991:
Parameters are replaced with their replacement list (without performing expansion).
700:#define <identifier>(<parameter list>) <replacement token list>
594:/* _WIN32 is usually defined by compilers targeting 32 or 64 bit Windows systems */
345:
One of the most common uses of the preprocessor is to include another source file:
307:
2370:
1755:#pragma message("Do not use ABC, which is deprecated. Use XYZ instead.")
264:
for parameterless macros, respectively. It was extended shortly after, firstly by
2750:
2710:
2618:
1911:
822:
is enclosed in its own pair of parentheses to avoid the possibility of incorrect
425:
272:
2427:
1993:
1941:
General-purpose text preprocessing with the C preprocessor. Featuring JavaScript
1717:
Many implementations do not support trigraphs or do not replace them by default.
1119:#define DEBUGPRINT(_fmt, ...) DEBUGPRINT2(WHERESTR _fmt, WHEREARG, __VA_ARGS__)
826:
when it is an expression instead of a single value. For example, the expression
439:
extension. However, there is no requirement that this be observed. Files with a
2923:
2768:
2730:
2656:
2375:
The Second ACM SIGPLAN Conference on
History of Programming Languages (HOPL-II)
2339:
2273:
1883:
1612:
1565:
1380:
1320:
1963:
2958:
2826:
2816:
2755:
2024:
1045:// "HI THERE", because concatenation occurs before normal expansion
694:#define <identifier> <replacement token list>
458:
2221:
1646:
1590:(unless a parameter changes the embed element width to something other than
1313:
2796:
2561:
1275:
792:, as object-like macros, may be replaced with their value at compile-time.
214:
190:
2386:
2360:
2343:
1745:#warning "Do not use ABC, which is deprecated. Use XYZ instead."
2887:
2443:
1864:
1801:
1789:
1682:, which compiler vendors may use for their own purposes. For instance, a
1341:
748:
465:
202:
2531:
2510:
2317:
1735:
1601:
725:#undef <identifier>
414:
292:
233:
1165:
argument is concatenated with the string following it. The values of
579:/* __unix__ is usually defined by compilers targeting Unix systems */
265:
1607:
The file to be embedded can be specified in an identical fashion to
2831:
2821:
2801:
2646:
2613:
2551:
2037:
1906:
1592:
1263:
448:
410:
with the textual content of the file 'stdio.h', which declares the
1981:
List of predefined ANSI C and
Microsoft C++ implementation macros.
1508:#define DECLARE_STRUCT_TYPE(name) typedef struct name##_s name##_t
295:
with the characters they represent. This phase will be removed in
244:
The preprocessor was introduced to C around 1973 at the urging of
2515:
2437:
1991:
1856:
1813:
1725:
1621:
1356:
1337:
1336:
One little-known usage pattern of the C preprocessor is known as
1104:// debugging macros so we can pin down message origin at a glance
760:
567:
macro, it can be specified on the compiler's command line, using
479:
310:
300:
210:
1863:
is limited: the input language must be sufficiently C-like. The
2786:
2683:
2678:
2485:
2420:. The latest publicly available version of the C11 standard is
1687:
1329:
806:
1968:
HOPL: Online
Historical Encyclopaedia of Programming Languages
1820:. These directives are the only ones that do not start with a
563:
instead. For such compilers that do not implicitly define the
2872:
2811:
2791:
2715:
2663:
2651:
1852:
1809:
1586:
306:
Line splicing: Physical source lines that are continued with
206:
2673:
1762:
1569:
1116:#define DEBUGPRINT2(...) fprintf(stderr, __VA_ARGS__)
1081:// "HI THERE", because this evaluates to CAT(a,b)
253:
249:
1780:
1669:
1645:. Implementation-defined parameters use a form similar to
2490:
1738:
and only included for compatibility reasons; for example:
1324:
1305:
1690:
parallelization library can automatically parallelize a
451:
image file (which is at the same time a C source file).
2180:"Working Draft, Standard for Programming Language C++"
1964:"Bell SAP โ SAP with conditional and recursive macros"
1537:
directive outputs a message through the error stream.
320:
Tokenization: The preprocessor breaks the result into
283:
Preprocessing is defined by the first four (of eight)
2222:"N4720: Working Draft, Extensions to C++ for Modules"
1992:
Gabriel Dos Reis; Bjarne
Stroustrup (22 March 2010).
431:
By convention, include files are named with either a
1383:, escaping any quotes or backslashes appropriately.
1319:
Macros that can take a varying number of arguments (
656:
Translation can also be caused to fail by using the
16:
Macro preprocessor for several programming languages
2125:
2123:
420:This can also be written using double quotes, e.g.
1528:
213:languages. The preprocessor provides inclusion of
1523:// Outputs: typedef struct g_object_s g_object_t;
676:
619:is then included. Otherwise, it tests if a macro
2956:
2120:
1882:and that double quotes, which cpp interprets as
1847:Preprocessor ยง General purpose preprocessor
1418:// outputs "p = \"foo\\n\";"
1333:, for example when logging warnings and errors.
1086:
997:Tokens originating from parameters are expanded.
984:macro expansion occurs in the following stages:
291:Trigraph replacement: The preprocessor replaces
2260:"1.3 Preprocessing and conditional compilation"
2152:"WG14-N3096 : Draft for ISO/IEC 9899:2023"
1266:refer also to the source position defined with
2459:
1547:
1000:The resulting tokens are expanded as normal.
55:Learn how and when to remove these messages
2473:
2466:
2452:
2318:"Is the C99 preprocessor Turing complete?"
1871:compiler, which has similar capabilities.
473:
2438:Pre-defined C/C++ Compiler Macros project
2433:Visual Studio .NET preprocessor reference
2359:
1816:has the import and module directives for
1357:Pre-defined C/C++ Compiler Macros project
173:Learn how and when to remove this message
155:Learn how and when to remove this message
2246:"P1857R1 โ Modules Dependency Discovery"
1362:
898:gives precedence to the multiplication.
795:An example of a function-like macro is:
634:example can use operators; for example:
118:This article includes a list of general
2338:
2018:
1951:
1781:Language-specific preprocessor features
1670:Compiler-specific preprocessor features
716:A macro definition can be removed with
703:// function-like macro, note parameters
648:// we are compiling for a 64-bit system
642:// we are compiling for a 32-bit system
623:is defined instead. If it is, the file
328:. It replaces comments with whitespace.
2957:
2208:"Wrapper Headers (The C Preprocessor)"
2116:from the original on 24 December 2022.
2035:
1956:
1776:for chaining headers of the same name.
1491:
1304:The second edition of the C Standard,
2447:
2144:
1832:respectively, optionally preceded by
1004:This may produce surprising results:
976:
2061:
1874:CPP also works acceptably with most
1824:character; instead, they start with
1344:. Commonly, these use the extension
1113:#define WHEREARG __FILE__, __LINE__
800:#define RADTODEG(x) ((x) * 57.29578)
104:
61:
20:
2371:"The Development of the C Language"
2344:"The Development of the C Language"
2324:from the original on 24 April 2016.
2234:from the original on 30 April 2019.
406:The preprocessor replaces the line
13:
2168:from the original on 2 April 2023.
1656:
1015:#define HELLO "HI THERE"
973:gives precedence to the division.
611:The example code tests if a macro
340:
124:it lacks sufficient corresponding
14:
2986:
2411:
2006:from the original on 13 June 2018
88:and remove advice or instruction.
36:This article has multiple issues.
2937:
2936:
1542:#error "error message"
1110:#define WHERESTR ": "
788:Usages of variables declared as
109:
66:
25:
2310:
2296:"Overview (The C Preprocessor)"
2288:
2266:
2252:
2238:
2214:
2200:
2189:
2172:
1729:
1710:
1596:). Apart from the convenience,
1577:
1529:User-defined compilation errors
1222:
950:
923:
902:
875:
848:
827:
817:
681:There are two types of macros:
615:is defined. If it is, the file
523:
519:
515:
511:
44:or discuss these issues on the
2131:"The C Preprocessor: Overview"
2098:
2055:
2029:
1985:
1974:
1945:
1934:
1701:C99 introduced a few standard
1293:Other Standard macros include
677:Macro definition and expansion
1:
2062:Beal, Stephan (August 2004).
1927:
1855:system and for preprocessing
1840:
1568:which have a length limit on
1087:Special macros and directives
470:to prevent double inclusion.
287:specified in the C Standard.
228:The language of preprocessor
2274:"Using the fpp Preprocessor"
1861:general purpose preprocessor
1705:directives, taking the form
1379:) converts a token into a C
1173:can be manipulated with the
7:
2975:Macro programming languages
2369:Ritchie, Dennis M. (1993).
1900:
1680:compiler-specific directive
1348:instead of the traditional
1024:#define CALL(fn) fn(HE,LLO)
10:
2993:
2850:Compatibility of C and C++
2332:
2036:Meyers, Randy (May 2001).
1889:The C preprocessor is not
1859:. However, such use as a
1844:
1611:, meaning, either between
1467:// outputs "foo"
1186:#line 314 "pi.c"
1021:#define XCAT(a,b) CAT(a,b)
668:#error 1.9.0 not supported
518:are simple shorthands for
239:
2932:
2916:
2863:
2840:
2777:
2696:
2627:
2579:
2570:
2524:
2481:
1548:Binary resource inclusion
1436:// outputs "\n"
1278:specified that the macro
551:Most compilers targeting
540:"trace message"
457:often compels the use of
447:is likely to refer to an
278:
2970:Transformation languages
2965:C (programming language)
1749:
1739:
1696:#pragma omp parallel for
1641:is interchangeable with
1580:is initialized using an
1539:
1505:
1482:// outputs "4"
1443:
1388:
1373:stringification operator
1297:, the current date, and
1227:
1183:
1101:
1006:
797:
765:
739:
722:
691:
662:
636:
573:
528:
408:#include <stdio.h>
347:
1564:and without the use of
1371:operator (known as the
949:; without parentheses,
874:; without parentheses,
759:keyword, introduced in
665:#if RUBY_VERSION == 190
508:conditional compilation
474:Conditional compilation
299:following the steps of
223:conditional compilation
139:more precise citations.
2855:Comparison with Pascal
2475:C programming language
2086:Cite journal requires
1917:m4 (computer language)
1446:#define xstr(s) str(s)
317:to form logical lines.
2428:GNU CPP online manual
2387:10.1145/154766.155580
2361:10.1145/155360.155580
2196:GCC Obsolete features
2038:"The New C: X Macros"
1742:// GNU, Intel and IBM
1363:Token stringification
1236:"line=%d file=%s
1195:"line=%d file=%s
1018:#define CAT(a,b) a##b
847:expands correctly as
591:#elif defined _WIN32
285:phases of translation
195:programming languages
193:for several computer
2381:. pp. 201โ208.
1769:used in programming.
1377:stringizing operator
1308:, added support for
1301:, the current time.
1157:prints the value of
697:// object-like macro
417:among other things.
322:preprocessing tokens
225:, and line control.
86:rewrite this article
2354:(3). ACM: 201โ208.
2348:ACM SIGPLAN Notices
1792:preprocessors have
1555:will introduce the
1511:DECLARE_STRUCT_TYPE
1492:Token concatenation
824:order of operations
728:// delete the macro
531:#if VERBOSE >= 2
445:#include "icon.xbm"
380:"Hello, World!
209:, and a variety of
2340:Ritchie, Dennis M.
2042:Dr. Dobb's Journal
1876:assembly languages
1340:. An X-Macro is a
1012:#define LLO _THERE
977:Order of expansion
763:, is used instead:
742:#define PI 3.14159
627:is then included.
555:implicitly define
422:#include "stdio.h"
293:trigraph sequences
191:macro preprocessor
2952:
2951:
2692:
2691:
1922:PL/I preprocessor
1449:#define str(s) #s
1391:#define str(s) #s
625:<windows.h>
603:<windows.h>
553:Microsoft Windows
524:#if !defined(...)
183:
182:
175:
165:
164:
157:
103:
102:
79:a manual or guide
59:
2982:
2940:
2939:
2577:
2576:
2572:Standard library
2468:
2461:
2454:
2445:
2444:
2407:
2405:
2403:
2365:
2363:
2326:
2325:
2314:
2308:
2307:
2292:
2286:
2285:
2283:
2281:
2270:
2264:
2263:
2256:
2250:
2249:
2242:
2236:
2235:
2233:
2226:
2218:
2212:
2211:
2204:
2198:
2193:
2187:
2186:
2185:. 22 March 2023.
2184:
2176:
2170:
2169:
2167:
2161:. 1 April 2023.
2156:
2148:
2142:
2141:
2139:
2137:
2127:
2118:
2117:
2112:. 27 June 2022.
2102:
2096:
2095:
2089:
2084:
2082:
2074:
2072:
2070:
2059:
2053:
2052:
2050:
2048:
2033:
2027:
2022:
2016:
2015:
2013:
2011:
2005:
1998:
1989:
1983:
1978:
1972:
1971:
1960:
1954:
1949:
1943:
1938:
1881:
1835:
1831:
1827:
1823:
1804:
1799:
1796:, which is like
1795:
1775:
1756:
1753:
1746:
1743:
1733:
1732:
1713:was also added.
1712:
1708:
1707:#pragma STDC ...
1704:
1697:
1693:
1685:
1677:
1652:
1644:
1640:
1635:
1631:
1627:
1619:
1610:
1599:
1595:
1589:
1583:
1579:
1575:
1563:
1558:
1543:
1536:
1524:
1521:
1518:
1515:
1512:
1509:
1499:
1483:
1480:
1477:
1474:
1471:
1468:
1465:
1462:
1459:
1456:
1453:
1450:
1447:
1437:
1434:
1431:
1428:
1425:
1422:
1419:
1416:
1413:
1410:
1407:
1404:
1401:
1398:
1395:
1392:
1370:
1351:
1347:
1332:
1311:
1300:
1296:
1289:
1285:
1284:__STDC_VERSION__
1281:
1273:
1269:
1258:
1255:
1254:"pi.c"
1252:
1249:
1246:
1243:
1240:
1237:
1234:
1231:
1224:
1217:
1214:
1211:
1208:
1205:
1202:
1199:
1196:
1193:
1190:
1187:
1180:
1176:
1172:
1168:
1164:
1160:
1153:
1150:
1147:
1144:
1141:
1138:
1135:
1132:
1129:
1126:
1123:
1120:
1117:
1114:
1111:
1108:
1105:
1098:
1094:
1082:
1079:
1076:
1073:
1070:
1067:
1064:
1061:
1058:
1055:
1052:
1049:
1046:
1043:
1040:
1037:
1034:
1031:
1028:
1025:
1022:
1019:
1016:
1013:
1010:
972:
971:
968:
965:
962:
959:
956:
953:
948:
947:
944:
941:
938:
935:
932:
929:
926:
921:
920:
917:
914:
911:
908:
905:
897:
896:
893:
890:
887:
884:
881:
878:
873:
872:
869:
866:
863:
860:
857:
854:
851:
846:
845:
842:
839:
836:
833:
830:
821:
820:
812:
801:
791:
784:
781:
778:
775:
772:
769:
758:
754:
743:
729:
726:
719:
704:
701:
698:
695:
672:
669:
666:
659:
652:
649:
646:
643:
640:
633:
626:
622:
618:
617:<unistd.h>
614:
607:
604:
601:
598:
595:
592:
589:
588:<unistd.h>
586:
583:
580:
577:
576:#ifdef __unix__
570:
566:
562:
558:
547:
544:
541:
538:
535:
532:
525:
521:
520:#if defined(...)
517:
513:
506:can be used for
505:
501:
497:
493:
489:
485:
468:
461:
456:
446:
442:
438:
434:
423:
413:
409:
402:
399:
396:
393:
390:
387:
384:
381:
378:
375:
372:
369:
366:
363:
360:
357:
354:
351:
335:
263:
259:
178:
171:
160:
153:
149:
146:
140:
135:this article by
126:inline citations
113:
112:
105:
98:
95:
89:
77:is written like
70:
69:
62:
51:
29:
28:
21:
2992:
2991:
2985:
2984:
2983:
2981:
2980:
2979:
2955:
2954:
2953:
2948:
2928:
2912:
2865:
2859:
2843:other languages
2842:
2841:Comparison with
2836:
2773:
2711:Borland Turbo C
2688:
2628:Implementations
2623:
2566:
2520:
2477:
2472:
2422:the final draft
2414:
2401:
2399:
2397:
2368:
2335:
2330:
2329:
2316:
2315:
2311:
2294:
2293:
2289:
2279:
2277:
2272:
2271:
2267:
2258:
2257:
2253:
2244:
2243:
2239:
2231:
2224:
2220:
2219:
2215:
2206:
2205:
2201:
2194:
2190:
2182:
2178:
2177:
2173:
2165:
2154:
2150:
2149:
2145:
2135:
2133:
2129:
2128:
2121:
2104:
2103:
2099:
2087:
2085:
2076:
2075:
2068:
2066:
2060:
2056:
2046:
2044:
2034:
2030:
2023:
2019:
2009:
2007:
2003:
1996:
1990:
1986:
1979:
1975:
1962:
1961:
1957:
1950:
1946:
1939:
1935:
1930:
1903:
1891:Turing-complete
1884:string literals
1879:
1849:
1843:
1833:
1829:
1825:
1821:
1802:
1797:
1793:
1783:
1773:
1758:
1757:
1754:
1751:
1748:
1747:
1744:
1741:
1730:
1706:
1702:
1695:
1691:
1683:
1678:directive is a
1675:
1672:
1659:
1657:Implementations
1650:
1642:
1638:
1633:
1629:
1625:
1617:
1608:
1597:
1591:
1585:
1581:
1573:
1572:. Similarly to
1566:string literals
1561:
1556:
1550:
1545:
1544:
1541:
1534:
1531:
1526:
1525:
1522:
1519:
1516:
1513:
1510:
1507:
1497:
1494:
1485:
1484:
1481:
1478:
1475:
1472:
1469:
1466:
1463:
1460:
1457:
1454:
1451:
1448:
1445:
1439:
1438:
1435:
1432:
1429:
1426:
1423:
1420:
1417:
1414:
1411:
1408:
1405:
1402:
1399:
1396:
1393:
1390:
1368:
1365:
1349:
1345:
1328:
1321:variadic macros
1309:
1298:
1294:
1287:
1283:
1279:
1271:
1267:
1260:
1259:
1256:
1253:
1250:
1247:
1244:
1241:
1238:
1235:
1232:
1229:
1219:
1218:
1215:
1212:
1209:
1206:
1203:
1200:
1197:
1194:
1191:
1188:
1185:
1178:
1177:directive. The
1174:
1170:
1166:
1162:
1158:
1155:
1154:
1151:
1148:
1145:
1142:
1139:
1137:"hey, x=%d
1136:
1133:
1130:
1127:
1124:
1121:
1118:
1115:
1112:
1109:
1106:
1103:
1096:
1092:
1089:
1084:
1083:
1080:
1077:
1074:
1071:
1068:
1065:
1062:
1059:
1056:
1053:
1050:
1047:
1044:
1041:
1038:
1035:
1032:
1029:
1026:
1023:
1020:
1017:
1014:
1011:
1008:
979:
969:
966:
963:
960:
957:
954:
951:
945:
942:
939:
936:
933:
930:
927:
924:
918:
915:
912:
909:
906:
903:
894:
891:
888:
885:
882:
879:
876:
870:
867:
864:
861:
858:
855:
852:
849:
843:
840:
837:
834:
831:
828:
818:
810:
805:This defines a
803:
802:
799:
789:
786:
785:
782:
779:
776:
773:
770:
767:
756:
752:
745:
744:
741:
731:
730:
727:
724:
717:
706:
705:
702:
699:
696:
693:
679:
674:
673:
670:
667:
664:
657:
654:
653:
650:
647:
644:
641:
638:
631:
630:A more complex
624:
620:
616:
612:
609:
608:
605:
602:
599:
596:
593:
590:
587:
584:
581:
578:
575:
568:
564:
560:
556:
549:
548:
545:
542:
539:
536:
533:
530:
503:
499:
495:
491:
487:
483:
476:
466:
459:
454:
444:
440:
436:
432:
421:
411:
407:
404:
403:
400:
397:
394:
391:
388:
385:
382:
379:
376:
373:
370:
367:
364:
361:
358:
355:
353:<stdio.h>
352:
349:
343:
341:Including files
333:
281:
273:Douglas McIlroy
261:
257:
242:
179:
168:
167:
166:
161:
150:
144:
141:
131:Please help to
130:
114:
110:
99:
93:
90:
83:
71:
67:
30:
26:
17:
12:
11:
5:
2990:
2989:
2978:
2977:
2972:
2967:
2950:
2949:
2947:
2946:
2933:
2930:
2929:
2927:
2926:
2924:Dennis Ritchie
2920:
2918:
2914:
2913:
2911:
2910:
2905:
2900:
2895:
2890:
2885:
2880:
2875:
2869:
2867:
2861:
2860:
2858:
2857:
2852:
2846:
2844:
2838:
2837:
2835:
2834:
2829:
2824:
2819:
2814:
2809:
2804:
2799:
2794:
2789:
2783:
2781:
2775:
2774:
2772:
2771:
2766:
2753:
2748:
2743:
2738:
2733:
2728:
2723:
2718:
2713:
2708:
2702:
2700:
2694:
2693:
2690:
2689:
2687:
2686:
2681:
2676:
2671:
2666:
2661:
2660:
2659:
2649:
2644:
2643:
2642:
2631:
2629:
2625:
2624:
2622:
2621:
2616:
2611:
2606:
2601:
2599:Dynamic memory
2596:
2591:
2586:
2580:
2574:
2568:
2567:
2565:
2564:
2559:
2554:
2549:
2544:
2539:
2534:
2528:
2526:
2522:
2521:
2519:
2518:
2513:
2508:
2503:
2498:
2493:
2488:
2482:
2479:
2478:
2471:
2470:
2463:
2456:
2448:
2442:
2441:
2435:
2430:
2425:
2413:
2412:External links
2410:
2409:
2408:
2395:
2366:
2342:(March 1993).
2334:
2331:
2328:
2327:
2309:
2287:
2265:
2262:. GNU Project.
2251:
2237:
2213:
2199:
2188:
2171:
2143:
2119:
2097:
2088:|journal=
2054:
2028:
2017:
1984:
1973:
1955:
1952:Ritchie (1993)
1944:
1932:
1931:
1929:
1926:
1925:
1924:
1919:
1914:
1909:
1902:
1899:
1842:
1839:
1838:
1837:
1807:
1782:
1779:
1778:
1777:
1770:
1759:
1750:
1740:
1718:
1671:
1668:
1658:
1655:
1649:syntax (e.g.,
1549:
1546:
1540:
1530:
1527:
1506:
1493:
1490:
1444:
1389:
1381:string literal
1364:
1361:
1228:
1221:generates the
1184:
1102:
1088:
1085:
1007:
1002:
1001:
998:
995:
992:
989:
978:
975:
798:
766:
740:
723:
692:
678:
675:
663:
637:
574:
529:
475:
472:
348:
342:
339:
338:
337:
329:
318:
313:sequences are
304:
280:
277:
241:
238:
187:C preprocessor
181:
180:
163:
162:
117:
115:
108:
101:
100:
74:
72:
65:
60:
34:
33:
31:
24:
15:
9:
6:
4:
3:
2:
2988:
2987:
2976:
2973:
2971:
2968:
2966:
2963:
2962:
2960:
2945:
2944:
2935:
2934:
2931:
2925:
2922:
2921:
2919:
2915:
2909:
2906:
2904:
2901:
2899:
2896:
2894:
2891:
2889:
2886:
2884:
2881:
2879:
2876:
2874:
2871:
2870:
2868:
2862:
2856:
2853:
2851:
2848:
2847:
2845:
2839:
2833:
2830:
2828:
2827:Visual Studio
2825:
2823:
2820:
2818:
2817:GNOME Builder
2815:
2813:
2810:
2808:
2805:
2803:
2800:
2798:
2795:
2793:
2790:
2788:
2785:
2784:
2782:
2780:
2776:
2770:
2767:
2765:
2761:
2757:
2756:Visual Studio
2754:
2752:
2749:
2747:
2744:
2742:
2739:
2737:
2734:
2732:
2729:
2727:
2724:
2722:
2719:
2717:
2714:
2712:
2709:
2707:
2704:
2703:
2701:
2699:
2695:
2685:
2682:
2680:
2677:
2675:
2672:
2670:
2667:
2665:
2662:
2658:
2655:
2654:
2653:
2650:
2648:
2645:
2641:
2638:
2637:
2636:
2633:
2632:
2630:
2626:
2620:
2617:
2615:
2612:
2610:
2607:
2605:
2602:
2600:
2597:
2595:
2592:
2590:
2587:
2585:
2582:
2581:
2578:
2575:
2573:
2569:
2563:
2560:
2558:
2555:
2553:
2550:
2548:
2545:
2543:
2540:
2538:
2535:
2533:
2530:
2529:
2527:
2523:
2517:
2514:
2512:
2509:
2507:
2504:
2502:
2499:
2497:
2494:
2492:
2489:
2487:
2484:
2483:
2480:
2476:
2469:
2464:
2462:
2457:
2455:
2450:
2449:
2446:
2439:
2436:
2434:
2431:
2429:
2426:
2423:
2419:
2416:
2415:
2398:
2396:0-89791-570-4
2392:
2388:
2384:
2380:
2376:
2372:
2367:
2362:
2357:
2353:
2349:
2345:
2341:
2337:
2336:
2323:
2319:
2313:
2306:
2301:
2297:
2291:
2275:
2269:
2261:
2255:
2247:
2241:
2230:
2223:
2217:
2209:
2203:
2197:
2192:
2181:
2175:
2164:
2160:
2153:
2147:
2132:
2126:
2124:
2115:
2111:
2107:
2101:
2093:
2080:
2065:
2064:"Supermacros"
2058:
2043:
2039:
2032:
2026:
2021:
2002:
1995:
1988:
1982:
1977:
1969:
1965:
1959:
1953:
1948:
1942:
1937:
1933:
1923:
1920:
1918:
1915:
1913:
1910:
1908:
1905:
1904:
1898:
1896:
1892:
1887:
1885:
1877:
1872:
1870:
1866:
1862:
1858:
1854:
1848:
1819:
1815:
1811:
1808:
1805:
1791:
1788:
1787:
1786:
1774:#include_next
1772:GCC provides
1771:
1768:
1764:
1760:
1737:
1727:
1723:
1719:
1716:
1715:
1714:
1699:
1689:
1681:
1667:
1663:
1654:
1648:
1623:
1614:
1605:
1603:
1594:
1588:
1578:unsigned char
1571:
1567:
1554:
1538:
1504:
1501:
1489:
1452:#define foo 4
1442:
1387:
1384:
1382:
1378:
1374:
1360:
1358:
1353:
1343:
1339:
1334:
1331:
1326:
1322:
1317:
1315:
1307:
1302:
1291:
1277:
1265:
1226:
1182:
1100:
1009:#define HE HI
1005:
999:
996:
993:
990:
987:
986:
985:
983:
982:Function-like
974:
899:
825:
814:
808:
796:
793:
764:
762:
750:
738:
735:
721:
714:
711:
710:function-like
690:
688:
687:function-like
684:
661:
635:
628:
572:
554:
527:
509:
481:
471:
469:
463:
452:
450:
429:
427:
418:
416:
346:
330:
327:
323:
319:
316:
312:
309:
305:
302:
298:
294:
290:
289:
288:
286:
276:
274:
269:
267:
255:
251:
247:
237:
235:
231:
226:
224:
220:
216:
212:
208:
204:
200:
196:
192:
188:
177:
174:
159:
156:
148:
138:
134:
128:
127:
121:
116:
107:
106:
97:
94:February 2013
87:
82:
80:
75:This article
73:
64:
63:
58:
56:
49:
48:
43:
42:
37:
32:
23:
22:
19:
2941:
2797:Code::Blocks
2769:Watcom C/C++
2557:Preprocessor
2556:
2537:Header files
2418:ISO/IEC 9899
2400:. Retrieved
2374:
2351:
2347:
2312:
2303:
2299:
2290:
2278:. Retrieved
2268:
2254:
2240:
2216:
2202:
2191:
2174:
2159:open-std.org
2158:
2146:
2134:. Retrieved
2110:open-std.org
2109:
2100:
2079:cite journal
2067:. Retrieved
2057:
2045:. Retrieved
2041:
2031:
2020:
2008:. Retrieved
1987:
1976:
1967:
1958:
1947:
1936:
1888:
1873:
1850:
1803:#pragma once
1784:
1752:// Microsoft
1711:_Pragma(...)
1700:
1673:
1664:
1660:
1651:vendor::attr
1606:
1551:
1532:
1502:
1495:
1486:
1440:
1385:
1376:
1372:
1366:
1354:
1335:
1318:
1303:
1292:
1262:Source code
1261:
1220:
1156:
1090:
1003:
981:
980:
900:
815:
811:RADTODEG(34)
804:
794:
787:
746:
736:
732:
715:
709:
707:
686:
682:
680:
655:
629:
610:
550:
477:
467:#pragma once
453:
430:
419:
405:
344:
321:
314:
284:
282:
270:
243:
227:
221:expansions,
215:header files
186:
184:
169:
151:
142:
123:
91:
84:Please help
76:
52:
45:
39:
38:Please help
35:
18:
2888:Objective-C
2669:Windows CRT
2300:gcc.gnu.org
1865:GNU Fortran
1790:Objective-C
1342:header file
1288:__cplusplus
922:expands to
816:The second
749:hard-coding
747:instead of
683:object-like
660:directive:
482:directives
246:Alan Snyder
203:Objective-C
137:introducing
2959:Categories
2864:Descendant
2736:Norcroft C
2562:Data types
2511:Embedded C
2402:4 November
2280:14 October
2069:27 October
1928:References
1845:See also:
1841:Other uses
1767:assertions
1736:deprecated
1694:loop with
1639:__prefix__
1602:as-if rule
1276:C Standard
1225:function:
1131:DEBUGPRINT
1125:// is good
336:operators.
326:whitespace
234:text files
230:directives
197:, such as
145:March 2015
120:references
41:improve it
2866:languages
2698:Compilers
2640:libhybris
2542:Operators
2532:Functions
1728:will add
1647:attribute
1503:Example:
1406:"foo
1386:Example:
1264:debuggers
1107:// is bad
790:constexpr
768:constexpr
757:constexpr
275:in 1959.
266:Mike Lesk
47:talk page
2943:Category
2917:Designer
2832:NetBeans
2822:KDevelop
2802:CodeLite
2647:dietlibc
2614:Variadic
2589:File I/O
2525:Features
2322:Archived
2229:Archived
2163:Archived
2114:Archived
2001:Archived
1907:C syntax
1901:See also
1798:#include
1731:#warning
1634:if_empty
1613:chevrons
1609:#include
1593:CHAR_BIT
1517:g_object
1338:X-Macros
1314:agnostic
1310:__func__
1299:__TIME__
1295:__DATE__
1280:__STDC__
1272:__LINE__
1268:__FILE__
1213:__FILE__
1207:__LINE__
1171:__LINE__
1167:__FILE__
1163:WHERESTR
1097:__LINE__
1093:__FILE__
970:57.29578
943:57.29578
910:RADTODEG
892:57.29578
868:57.29578
829:RADTODEG
613:__unix__
569:-D_WIN32
460:#include
455:#include
426:makefile
415:function
412:printf()
350:#include
258:#include
2807:Eclipse
2760:Express
2516:MISRA C
2333:Sources
2276:. Intel
2136:17 July
1857:Fortran
1818:modules
1794:#import
1703:#pragma
1684:#pragma
1676:#pragma
1666:flags.
1622:urandom
807:radians
780:3.14159
600:include
585:include
516:#ifndef
492:#ifndef
480:ifโelse
334:_Pragma
315:spliced
311:newline
308:escaped
262:#define
240:History
211:Fortran
189:is the
133:improve
2787:Anjuta
2684:uClibc
2679:Newlib
2657:EGLIBC
2635:Bionic
2604:String
2552:Syntax
2547:String
2486:ANSI C
2393:
2010:8 July
1834:export
1830:module
1826:import
1812:as of
1688:OpenMP
1643:prefix
1630:suffix
1626:prefix
1624:. The
1598:#embed
1582:#embed
1574:xxd -i
1562:xxd -i
1557:#embed
1535:#error
1412:"
1330:printf
1242:"
1230:printf
1223:printf
1201:"
1189:printf
1143:"
771:double
718:#undef
671:#endif
658:#error
651:#endif
621:_WIN32
606:#endif
565:_WIN32
557:_WIN32
546:#endif
534:printf
512:#ifdef
504:#endif
502:, and
488:#ifdef
462:guards
392:return
386:"
374:printf
279:Phases
122:, but
2898:Limbo
2812:Geany
2792:CLion
2716:Clang
2664:klibc
2652:glibc
2619:POSIX
2232:(PDF)
2225:(PDF)
2183:(PDF)
2166:(PDF)
2155:(PDF)
2047:1 May
2004:(PDF)
1997:(PDF)
1869:ifort
1853:imake
1814:C++20
1761:Some
1726:C++23
1618:limit
1587:fread
1179:#line
1175:#line
1122:// OR
761:C++11
753:const
645:#else
561:WIN32
500:#elif
496:#else
301:C++17
219:macro
2908:Vala
2893:Alef
2779:IDEs
2746:SDCC
2674:musl
2609:Time
2594:Math
2584:Char
2404:2014
2391:ISBN
2282:2015
2138:2016
2092:help
2071:2008
2049:2008
2012:2024
1912:Make
1828:and
1763:Unix
1724:and
1674:The
1628:and
1570:MSVC
1533:The
1496:The
1470:xstr
1367:The
1346:.def
1270:and
1169:and
1095:and
1069:CALL
1048:XCAT
708:The
685:and
522:and
514:and
478:The
441:.def
437:.hpp
365:void
359:main
324:and
260:and
254:PL/I
252:and
250:BCPL
185:The
2873:C++
2764:C++
2751:TCC
2741:PCC
2731:LCC
2726:ICC
2721:GCC
2706:ACK
2506:C23
2501:C17
2496:C11
2491:C99
2383:doi
2379:ACM
2356:doi
1810:C++
1722:C23
1692:for
1553:C23
1476:foo
1461:foo
1455:str
1421:str
1394:str
1375:or
1325:C99
1306:C99
1248:314
1075:CAT
1060:LLO
1039:LLO
1027:CAT
632:#if
484:#if
464:or
449:XBM
435:or
356:int
297:C23
207:C++
2961::
2903:Go
2878:C#
2762:,
2758:,
2389:.
2377:.
2373:.
2352:28
2350:.
2346:.
2320:.
2302:.
2298:.
2227:.
2157:.
2122:^
2108:.
2083::
2081:}}
2077:{{
2040:.
1999:.
1966:.
1897:.
1895:m4
1698:.
1604:.
1520:);
1498:##
1415:;)
1409:\n
1350:.h
1257:);
1239:\n
1216:);
1198:\n
1152:);
1140:\n
1054:HE
1033:HE
931:((
850:((
774:PI
720::
571:.
543:);
526:.
510:.
498:,
494:,
490:,
486:,
433:.h
389:);
383:\n
236:.
217:,
205:,
201:,
50:.
2883:D
2467:e
2460:t
2453:v
2424:.
2406:.
2385::
2364:.
2358::
2284:.
2248:.
2210:.
2140:.
2094:)
2090:(
2073:.
2051:.
2014:.
1970:.
1880:#
1836:.
1822:#
1806:.
1514:(
1479:)
1473:(
1464:)
1458:(
1433:)
1430:n
1427:\
1424:(
1403:=
1400:p
1397:(
1369:#
1251:,
1245:,
1233:(
1210:,
1204:,
1192:(
1159:x
1149:x
1146:,
1134:(
1078:)
1072:(
1063:)
1057:,
1051:(
1042:)
1036:,
1030:(
967:*
964:)
961:r
958:(
955:/
952:1
946:)
940:*
937:)
934:r
928:/
925:1
919:)
916:r
913:(
907:/
904:1
895:)
889:*
886:1
883:+
880:r
877:(
871:)
865:*
862:)
859:1
856:+
853:r
844:)
841:1
838:+
835:r
832:(
819:x
783:;
777:=
597:#
582:#
537:(
401:}
398:;
395:0
377:(
371:{
368:)
362:(
303:.
199:C
176:)
170:(
158:)
152:(
147:)
143:(
129:.
96:)
92:(
81:.
57:)
53:(
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.