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 ...

Get C++ In a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.