Well, I'll start with the default constructor. Maybe others can edit this and add info for other constructors etc. SO was meant to be a collaborative effort.
Default constructor.
Relevant standardese:
C++14 §12.1/5
” […] The implicitly-defined default constructor performs the set of initializations of the class that would be performed by a user-written default constructor for that class with no ctor-initializer (12.6.2) and an empty compound-statement. If that user-written default constructor would be ill-formed, the program is ill-formed. If that user-written default constructor would satisfy the requirements of a constexpr
constructor (7.1.5), the implicitly-defined default constructor is constexpr
. Before the defaulted default constructor for a class is implicitly defined, all the non-user-provided default constructors for its base classes and its non-
static data members shall have been implicitly defined. [Note: An implicitly-declared default constructor has an exception-specification (15.4). An explicitly-defaulted definition might have an implicit exception-
specification, see 8.4. —end note ]
In effect, the generated default constructor for a class T
looks like
T(){}
or
constexpr T(){}
depending on whether it can be constexpr
.
One important consequence is that members of built-in types are not initialized, and are therefore left with indeterminate values. Except for char
types it's formally UB to use such values, although in practice, on modern machines it's just arbitrary values.
One important consideration is that this does not affect value initialization, e.g. the effect of T()
. It doesn't use the generated default constructor and ends up zero-initializing members of built-in types.