[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The global list current_member_init_list
contains the list of
mem-initializers specified in a constructor declaration. For example:
foo::foo() : a(1), b(2) {} |
will initialize `a' with 1 and `b' with 2.
expand_member_init
places each initialization (a with 1) on the
global list. Then, when the fndecl is being processed,
emit_base_init
runs down the list, initializing them. It used to
be the case that g++ first ran down current_member_init_list
,
then ran down the list of members initializing the ones that weren't
explicitly initialized. Things were rewritten to perform the
initializations in order of declaration in the class. So, for the above
example, `a' and `b' will be initialized in the order that
they were declared:
class foo { public: int b; int a; foo (); }; |
Thus, `b' will be initialized with 2 first, then `a' will be initialized with 1, regardless of how they're listed in the mem-initializer.
The use of explicit
on a constructor is used by grokdeclarator
to set the field DECL_NONCONVERTING_P
. That value is used by
build_method_call
and build_user_type_conversion_1
to decide
if a particular constructor should be used as a candidate for conversions.