Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is more to it.</p> <p><strong>1)</strong> For <strong>primitive</strong> or built-in types, <strong>implicitly</strong> initialized (or compiler initialized) means no-op (does nothing). </p> <p><strong>2)</strong> For <strong>primitive</strong> or built-in types, <strong>explicitly</strong> initialized (or initialized by the programmer) is obvious :) </p> <p>As in your example:</p> <pre><code> Student_info::Student_info(): midterm(0), final(0) {} </code></pre> <p><strong>3)</strong> For <strong>non-primitive</strong> types, <strong>implicitly</strong> initialized (or compiler initialized) means compiler may (or may not) synthesis a constructor for the purpose of initialization.</p> <blockquote> <pre><code> Usually, a constructor is synthesized by the compiler under the following cases: a) The non-primitive type is polymorphic or derives from some polymorphic/non-polymorphic types, b) The non-primitive type has a polymorphic/non-polymorphic member. Compiler synthesized constructor will usually have code to a) initialize v-pointer to v-table, b) call base class constructor, c) call constructors of members, so on, basically driven by the definition of non-primitive type. </code></pre> </blockquote> <p><strong>4)</strong> For <strong>non-primitive</strong> types, <strong>explicitly</strong> initialized (or initialized by the user supplied constructor) means compiler would make a call to the user defined constructor instead of synthesizing one for the purpose of initialization.</p> <p>For example, the default constructor defined by the respective non-primitive types (like std::string or std::vector) gets invoked. </p> <p>**</p> <blockquote> <p>Note: Compiler may still augment code inside the user-defined constructor to do some behind-the-scenes initialization as need be (look at step-3 above for such needs). Such augmented code will always be inserted before the user-defined code inside the constructor!</p> </blockquote> <p>**</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload