Add Book to My BookshelfPurchase This Book Online

Appendix A - Significant Changes in ANSI C

UNIX Systems Programming for SVR4
David A. Curry
 Copyright © 1996 O'Reilly & Associates, Inc.

Tokens
Tokens are the smallest recognizable units of the language. Tokens include operators, variable names, keywords, and constants.
String Concatenation
The ANSI C standard says that adjacent string constants with no operators between them should simply be concatenated. This means that
    "foo" "bar"
is equivalent to
    "foobar"
This is useful in situations in which a long string needs to be defined. For example:
    char *usage = "Usage: thisprogram [-b] [-g] [-l] files...\n"
                  "       -b    babble incessantly about everything\n"
                  "       -g    babble in ancient greek\n"
                  "       -l    babble in latin\n";
Escape Sequences
The ANSI C standard has defined some new backslash escape sequences:
\a
for “alert.” When printed, this sequence should ring the terminal's bell.
\v
for vertical tab (this escape was already supported by many compilers).
\x
for hexadecimal constant, much like a blackslash followed by a digit introduces an octal constant.
The number of digits in an octal constant has been formally limited to three; some compilers previously allowed more. This means that \0123 is now always a two-character string: the character with octal value 012 followed by the character 3.
The digits 8 and 9 are no longer allowed in octal constants. This shouldn't be any great surprise. However, some compilers allowed \128 and took it to mean \130.

Previous SectionNext Section
Books24x7.com, Inc © 2000 –  Feedback