Re: reorder member initialization…

Thanks, Atul! Yes, these warnings are quite annoying and appear often because the corresponding header is included by LocalPeer.h, which is included in a number of .cpp files. To be honest, I’ve always been too lazy to fix it, but will do so for the next release, unless somebody else provides a patch faster than me ;-).

atul wrote:Dear all

I got the following warning while compiling calitko-0.5.4

Gui/SearchModel.h: In constructor ‘SearchResult::SearchResult(const QString&, const QString&, const quint32&, quint32, QString, QString)’:
Gui/SearchModel.h:71: warning: ‘SearchResult::speed’ will be initialized after
Gui/SearchModel.h:68: warning: ‘QString SearchResult::rating’
Gui/SearchModel.h:31: warning: when initialized here
Gui/SearchModel.h:76: warning: ‘SearchResult::parent’ will be initialized after
Gui/SearchModel.h:75: warning: ‘bool SearchResult::showEmphasized’
Gui/SearchModel.h:31: warning: when initialized here
I think we should get rid of this warning by moving the rating after speed or rearrange member initialization list….

It is the order in which members are declared in the class, is the order respected for initialization… so here speed will be intialized AFTER rating…

just my two cents ;-)

Would you like to post a relpy?


This post is a reply to:
reorder member initialization…
Dear all I got the following warning while compiling calitko-0.5.4 Gui/SearchModel.h: In constructor ‘SearchResult::SearchResult(const QString&, const QString&, const quint32&, quint32, QString, QString)’: Gui/SearchModel.h:71: warning: ‘SearchResult::speed’ will be initialized after Gui/SearchModel.h:68: warning:   ‘QString SearchResult::rating’ Gui/SearchModel.h:31: warning:   (more...)

Follow-ups:
Re: Re: reorder member initialization…
Here is s tiny patch that fixes the initialization order warnings. Committed in revision 41.