I was just wondering about the best way to initialize member variables in a constructor... Scott Meyer's effective C++ recommands to init via the init list, in the same order member are declared (items 12 & 13).
... "initialization via a member initialization list is always legal, is never less efficient than assignment inside the body of the constructor, and is often more efficient."...
..."The bottom line is this: if you hope to understand what is really going on when your objects are initialized, be sure to list the members in an initialization list in the order in which those members are declared in the class."...
On the other hand, I have a friend who tells me that the compiler may order the members in any way, and that the internal representation of the class might not be that that was declared.
So my questions: is it still worth it to use the init list (I still believe it is), but is the order as important as we might think, when talking about efficiency, not possible errors (i.e. using uninit members...)?
Basically, what do you do? and why...? :)
25 points just for the fun of it!