Name

type — Type specifiers

Synopsis

               type-specifier ::= simple-type-specifier | class-specifier | enum-specifier |
    elaborated-type-specifier | cv-qualifier
               simple-type-specifier ::= [::] [nested-name ::] type-name | 
    [::] nested-name :: template template-id | bool | char | double | float | int |
    long | short | signed | unsigned | void | wchar_t
type-name ::= class-name | enum-name | typedef-name
               typedef-name ::= identifier
               elaborated-type-specifier ::= class-key [::] [nested-name ::] identifier | 
    class-key [::] [nested-name ::] [template] template-id | 
    enum [::] [nested-name ::] identifier | typename [::] nested-name :: identifier |
    typename [::] nested-name :: [template] template-id
            

Type specifiers are used throughout C++: in declarations, type casts, new expressions, and so on. Although the syntax rules shown here are quite flexible, the semantic rules impose many limits. For example, the simple syntax rules permit short long as a type (specifically, as a decl-specifier-seq; see declaration), but that combination of type specifiers is not permitted. See Chapter 2 for details about semantics for valid type specifiers.

See Also

class, const, declaration, declarator, enum, identifier, struct, template, typedef, typename, union, volatile, Chapter 2

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.