3 items | 3 visits
A collection of reference material covering everything from the C++ Standard, best practices, language nuances, etc...
Updated on Apr 20, 10
Created on Apr 20, 10
Category: Computers & Internet
URL:
Legendary Bjarne Stroustrup's C++ glossary, incredibly exhaustive.
Highlighted ISO definition of C++ reference type in wiki cause I can be lazy sometimes.
References are defined by the ISO C++ standard as follows (excluding the example section):
In a declaration T D where D has the form
& D1and the type of the identifier in the declaration T D1 is “derived-declarator-type-list
T,” then the type of the identifier of D is “derived-declarator-type-list reference toT.” Cv-qualified references are ill-formed except when the cv-qualifiers (constand volatile) are introduced through the use of atypedef(7.1.3) or of a template type argument (14.3), in which case the cv-qualifiers are ignored. [Example: intypedef int& A; const A aref = 3; // ill-formed; // non-const reference initialized with rvaluethe type of
arefis “reference toint”, not “constreference toint”. ] [Note: a reference can be thought of as a name of an object. ] A declarator that specifies the type “reference to cv void” is ill-formed.It is unspecified whether or not a reference requires storage (3.7).
There shall be no references to references, no arrays of references, and no pointers to references. The declaration of a reference shall contain an initializer (8.5.3) except when the declaration contains an explicit
externspecifier (7.1.1), is a class member (9.2) declaration within a class declaration, or is the declaration of a parameter or a return type (8.3.5); see 3.1. A reference shall be initialized to refer to a valid object or function. [Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by dereferencing a null pointer, which causes undefined behavior. As described in 9.6, a reference cannot be bound directly to a bitfield. ]—ISO/IEC 14882:1998(E), the ISO C++ standard, in section 8.3.2 [dcl.ref]
3 items | 3 visits
A collection of reference material covering everything from the C++ Standard, best practices, language nuances, etc...
Updated on Apr 20, 10
Created on Apr 20, 10
Category: Computers & Internet
URL: