[Development] commas in ctor-init-lists

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Thu Jun 2 01:10:34 CEST 2016


The leading comma's are also helpful if we have some part of the
initializer list protected by a preprocessor conditional (or might be
needed in the future).

QFoo::QFoo()
  : QBase()
  , m_f1()
#ifdef XYZ
  , m_f2()
#endif
  , m_f3()

Although I'm not sure if we have many (of any at all) such instances
in the Qt source.

But this form does take some getting used to. My natural tendency is
to put the comma at the end.

Just my 2ยข.

-mandeep



More information about the Development mailing list