<p>I noticed some code of a colleague today that initialized class variables in the initialization.  However it was causing a warning, he says because of the order they are in.  My question is why is it better to do variable initialization where it currently is and not within the curly brackets?</p>

<pre><code>DiagramScene::DiagramScene( int slideNo, QRectF screenRect, MainWindow* parent )
    : QGraphicsScene( screenRect, parent ),
    myParent( parent ), 
    slideUndoImageCurrentIndex(-1),
    nextGroupID(0),
    m_undoInProgress(false),
    m_deleteItemOnNextUndo(0)
    line(0),
    path(0)
{
    /* Setup default brush for background */
    scDetail-&gt;bgBrush.setStyle(Qt::SolidPattern);
    scDetail-&gt;bgBrush.setColor(Qt::white);
    setBackgroundBrush(scDetail-&gt;bgBrush);

}
</code></pre>

It is more efficient (in general). All members of a class are initialised in the constructor, whether you explicitly initialise them or not. If you do not specify an initialiser, then the default constructor of the member is run. If you assign a value in the constructor body, then the assignment operator is called again. This does not apply to scalar values, as in your example, since scalar values do not have constructors.
You can't accidentally assign a value twice in the initialiser list.
The compiler can check to make sure that the order in which you write the initialisers matches the order in which the members are defined in the class. The C++ standard requires that the members are initialised in the order they are declared, regardless of the order you write the initialisers. Having the compiler check this order ensures that the programmer knows which order the initialisers will be run in (again, this is more important for non-POD members than for scalars).
Reference types and
```
const
```
members must be initialised in the initialiser list, because you can't assign to a reference or to a
```
const
```
member.