This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 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....
View Full Document
- Summer '13
- GCC, C preprocessor