These are nine three character sequences all starting

Info icon This preview shows pages 6–8. Sign up to view the full content.

These are nine three-character sequences, all starting with ‘ ?? ’, that are defined by ISO C to stand for single characters. They permit obsolete systems that lack some of C’s punctuation to use C. For example, ‘ ??/ ’ stands for ‘ \ ’, so ’??/n’ is a character constant for a newline. 1 UTF-16 does not meet the requirements of the C standard for a wide character set, but the choice of 16-bit wchar_t is enshrined in some system ABIs so we cannot fix this.
Image of page 6

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Chapter 1: Overview 3 Trigraphs are not popular and many compilers implement them incorrectly. Portable code should not rely on trigraphs being either converted or ignored. With -Wtrigraphs ’ GCC will warn you when a trigraph may change the meaning of your program if it were converted. See [Wtrigraphs], page 57 . 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, or by separat- ing the string literal at the trigraph and making use of string literal concatenation. "(??\?)" is the string ‘ (???) ’, not ‘ (?] ’. Traditional C compilers do not recognize these idioms. The nine trigraphs and their replacements are Trigraph: ??( ??) ??< ??> ??= ??/ ??’ ??! ??- Replacement: [ ] { } # \ ^ | ~ 3. Continued lines are merged into one long line. A continued line is a line which ends with a backslash, ‘ \ ’. The backslash is removed and the 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 ‘ /* ’ and continue until the next ‘ */ ’. Block comments do not nest: /* this is /* one comment */ text outside comment Line comments begin with ‘ // ’ and continue to the end of the current line. Line comments do not 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 */ But beware of commenting out one end of a block comment with a line comment. // l.c. /* block comment begins oops! this isn’t a comment anymore */ Comments are not recognized within string literals. "/* blah */" is the string constant /* blah */ ’, not an empty string.
Image of page 7
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.
  • Summer '13
  • Noone
  • GCC, C preprocessor

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern