Red Hat ENTERPRISE LINUX 3 - USING CPP Using Instructions page 6

Using cpp, the c preprocessor
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING CPP:
Table of Contents

Advertisement

2
different one and use it without conversion. (GCC may lose track of the current line number
if a file doesn't consistently use one convention, as sometimes happens when it is edited on
computers with different conventions that share a network file system.) LF CR is included
because it has been reported as an end-of-line marker under exotic conditions.
If the last line of any input file lacks an end-of-line marker, the end of the file is considered to
implicitly supply one. The C standard says that this condition provokes undefined behavior, so
GCC will emit a warning message.
2. If trigraphs are enabled, they are replaced by their corresponding single characters.
These are nine three-character sequences, all starting with
for single characters. They permit obsolete systems that lack some of C's punctuation to use C.
For example,
??/
ignores trigraphs, but if you request a strictly conforming mode with the
converts them.
Trigraphs are not popular and many compilers implement them incorrectly. Portable code should
not rely on trigraphs being either converted or ignored. If you use the
options, GCC will warn you when a trigraph would change the meaning of your program if it
were converted.
In a string constant, you can prevent a sequence of question marks from being confused with a
trigraph by inserting a backslash between the question marks. "(??\?)" is the string
. Traditional C compilers do not recognize this idiom.
(?]
The nine trigraphs and their replacements are
Trigraph:
Replacement:
3. Continued lines are merged into one long line.
A continued line is a line that ends with a backslash,
following line is joined with the current one. No space is inserted, so you may split a line
anywhere, even in the middle of a word. (It is generally more readable to split lines only at
white space.)
The trailing backslash on a continued line is commonly referred to as a backslash-newline.
If there is white space between a backslash and the end of a line, that is still a continued line.
However, as this is usually the result of an editing mistake, and many compilers will not accept
it as a continued line, GCC will warn you about it.
4. All comments are replaced with single spaces.
There are two kinds of comments. Block comments begin with
. Block comments do not nest:
*/
/* this is /* one comment */ text outside comment
Line comments begin with
nest either, but it does not matter, because they would end in the same place anyway.
// this is // one comment
text outside comment
It is safe to put line comments inside block comments, or vice versa.
/* block comment
// contains line comment
yet more comment
*/ outside comment
// line comment /* contains block comment */
stands for
, so '??/n' is a character constant for a newline. By default, GCC
\
??(
??)
??
[
]
{
and continue to the end of the current line. Line comments do not
//
, that are defined by ISO C to stand
??
¡
??
??=
??/
}
#
\
. The backslash is removed and the
\
Chapter 1. Overview
option, then it
-std
or
-Wall
-Wtrigraphs
(???)
??'
??!
??-
^
|
~
and continue until the next
/*
, not

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents