O'Reilly logo

C++ In a Nutshell by Ray Lischner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12. Language Reference

Here begins the alphabetic reference. This chapter presents each language keyword with a syntax summary, description, and, in some cases, an example. The syntax summaries use a modified BNF (Backus Normal Form or Backus-Naur Form):

  • Terminal symbols (keywords and operator symbols) are in a constant-width typeface.

  • To avoid ambiguity, a terminal symbol that might be mistaken for a BNF metacharacter (e.g., a vertical bar or a square bracket) is enclosed in quotes (e.g., "|“).

  • Nonterminal symbols (syntax elements) are in an italic typeface.

  • Optional elements are in square brackets ([ like this ]).

  • Choices are separated by vertical bars (|).

  • A production (syntax description) is introduced with := or ::=. The traditional symbol (::=) is used for a complete definition. The abbreviated symbol (:=) is used when the righthand side is incomplete. For example, here is the complete definition of function-specifier as it is given under declaration:

    function-specifier ::= explicit | inline | virtual

    The following is a partial production of function-specifier:

    function-specifier := inline

    The abbreviated symbol (:=) lets you see that the syntax summary is incomplete. Whenever an incomplete rule is used, a cross reference (under “See Also”) leads you to the complete rule.

The starting point for parsing a C++ source file (the start symbol) is translation-unit, which you can find under declaration.

C++ syntax is complicated, and even simple statements require an understanding of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required