[Development] commas in ctor-init-lists

Philippe philwave at gmail.com
Thu Jun 2 07:16:48 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).

This is right.
This is what CLangFormat proposed me by default.
I thought is was a bit strange when I started to use this, but now I
would not change.

Philippe

On Wed, 1 Jun 2016 16:10:34 -0700
Mandeep Sandhu <mandeepsandhu.chd at gmail.com> wrote:

> 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
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development





More information about the Development mailing list