The implementation of this feature in gcc is

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

View Full Document Right Arrow Icon
’ escape sequences. The implementation of this feature in GCC is experimental; such characters are only accepted in the ‘ \u ’ and ‘ \U ’ forms and only if -fextended-identifiers ’ is used. As an extension, GCC treats ‘ $ ’ as a letter. This is for compatibility with some systems, such as VMS, where ‘ $ ’ is commonly used in system-defined function and object names. ‘ $ is not a letter in strictly conforming mode, or if you specify the ‘ -$ ’ option. See Chapter 12 [Invocation], page 56 . A preprocessing number has a rather bizarre definition. The category includes all the normal integer and floating point constants one expects of C, but also a number of other things one might not initially recognize as a number. Formally, preprocessing numbers begin with an optional period, a required decimal digit, and then continue with any sequence of letters, digits, underscores, periods, and exponents. Exponents are the two-character sequences ‘ e+ ’, ‘ e- ’, ‘ E+ ’, ‘ E- ’, ‘ p+ ’, ‘ p- ’, ‘ P+ ’, and ‘ P- ’. (The exponents that begin with ‘ p or ‘ P ’ are new to C99. They are used for hexadecimal floating-point constants.) The purpose of this unusual definition is to isolate the preprocessor from the full com- plexity of numeric constants. It does not have to distinguish between lexically valid and invalid floating-point numbers, which is complicated. The definition also permits you to split an identifier at any position and get exactly two tokens, which can then be pasted back together with the ‘ ## ’ operator. It’s possible for preprocessing numbers to cause programs to be misinterpreted. For example, 0xE+12 is a preprocessing number which does not translate to any valid numeric constant, therefore a syntax error. It does not mean 0xE + 12 , which is what you might have intended. String literals are string constants, character constants, and header file names (the argu- ment of ‘ #include ’). 2 String constants and character constants are straightforward: "..." or ’...’ . In either case embedded quotes should be escaped with a backslash: ’\’’ is the character constant for ‘ ’. There is no limit on the length of a character constant, but the value of a character constant that contains more than one character is implementation- defined. See Chapter 11 [Implementation Details], page 51 . Header file names either look like string constants, "..." , or are written with angle brackets instead, <...> . In either case, backslash is an ordinary character. There is no way to escape the closing quote or angle bracket. The preprocessor looks for the header file in different places depending on which form you use. See Section 2.2 [Include Operation], page 8 . No string literal may extend past the end of a line. Older versions of GCC accepted multi- line string constants. You may use continued lines instead, or string constant concatenation.
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
Image of page 10
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