See section 114 differences from previous versions

Info icon This preview shows pages 9–11. Sign up to view the full content.

View Full Document Right Arrow Icon
See Section 11.4 [Differences from previous versions], page 55 . Punctuators are all the usual bits of punctuation which are meaningful to C and C ++ . All but three of the punctuation characters in ASCII are C punctuators. The exceptions are ‘ @ ’, $ ’, and ‘ ’. In addition, all the two- and three-character operators are punctuators. There 2 The C standard uses the term string literal to refer only to what we are calling string constants .
Image of page 9

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

View Full Document Right Arrow Icon
Chapter 1: Overview 6 are also six digraphs , which the C ++ standard calls alternative tokens , which are merely alternate ways to spell other punctuators. This is a second attempt to work around missing punctuation in obsolete systems. It has no negative side effects, unlike trigraphs, but does not cover as much ground. The digraphs and their corresponding normal punctuators are: Digraph: <% %> <: :> %: %:%: Punctuator: { } [ ] # ## Any other single character is considered “other”. It is passed on to the preprocessor’s output unmolested. The C compiler will almost certainly reject source code containing “other” tokens. In ASCII, the only other characters are ‘ @ ’, ‘ $ ’, ‘ ’, and control charac- ters other than NUL (all bits zero). (Note that ‘ $ ’ is normally considered a letter.) All characters with the high bit set (numeric range 0x7F–0xFF) are also “other” in the present implementation. This will change when proper support for international character sets is added to GCC. NUL is a special case because of the high probability that its appearance is accidental, and because it may be invisible to the user (many terminals do not display NUL at all). Within comments, NULs are silently ignored, just as any other character would be. In running text, NUL is considered white space. For example, these two directives have the same meaning. #define X^@1 #define X 1 (where ‘ ^@ ’ is ASCII NUL). Within string or character constants, NULs are preserved. In the latter two cases the preprocessor emits a warning message. 1.4 The preprocessing language After tokenization, the stream of tokens may simply be passed straight to the compiler’s parser. However, if it contains any operations in the preprocessing language , it will be transformed first. This stage corresponds roughly to the standard’s “translation phase 4” and is what most people think of as the preprocessor’s job. The preprocessing language consists of directives to be executed and macros to be ex- panded. Its primary capabilities are: Inclusion of header files. These are files of declarations that can be substituted into your program. Macro expansion. You can define macros , which are abbreviations for arbitrary frag- ments of C code. The preprocessor will replace the macros with their definitions throughout the program. Some macros are automatically defined for you.
Image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

{[ 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