[C/C++]C++标准
本文若如特别说明都引于ISO/IEC 14882:2011
7、声明(Declarations)
声明序列(declaration-seq):
声明(declaration)
声明序列(declaration-seq) 声明(declaration)
声明(declaration):
block-declaration
function-definition
template-declaration
explicit-instantiation
explicit-specialization
linkage-specification
namespace-definition
empty-declaration
attribute-declaration
block-declaration:
simple-declaration
asm-definition
namespace-alias-definition
using-declaration
using-directive
static_assert-declaration
alias-declaration
opaque-enum-declaration
alias-declaration:
using identifier attribute-specifier-seqopt = type-id ;
simple-declaration:
声明限定符序列[可选](decl-specifier-seqopt) init-declarator-listopt;
attribute-specifier-seq decl-specifier-seqopt init-declarator-list ;
static_assert-declaration:
static_assert ( constant-expression , string-literal ) ;
empty-declaration:
;
attribute-declaration:
attribute-specifier-seq ;
7.1、限定符(Specifiers)
decl-specifier:
storage-class-specifier
type-specifier
function-specifier
friend
typedef
constexpr
decl-specifier-seq:
decl-specifier attribute-specifier-seqopt
decl-specifier decl-specifier-seq
7.1.1、Storage class specifiers
storage-class-specifier:
register
static
thread_local
extern
mutable
7.1.6、类型限定符(Type specifiers)
type-specifier:
trailing-type-specifier
class-specifier
enum-specifier
trailing-type-specifier:
simple-type-specifier
elaborated-type-specifier
typename-specifier
cv-qualifier
type-specifier-seq:
type-specifier attribute-specifier-seqopt
type-specifier type-specifier-seq
trailing-type-specifier-seq:
trailing-type-specifier attribute-specifier-seqopt
trailing-type-specifier trailing-type-specifier-seq
作为一般规则,最多一个类型说明符是完整的声明说明符声明的允许或SEQ
在类型说明符类型说明符序列SEQ或尾随。这个规则的唯一例外是以下: