Qt/C++ coding style question

Amit Chaudhuri amit.k.chaudhuri at gmail.com
Tue Jun 4 02:11:52 PDT 2013


Hi Guys,

my daughter is 18 today which makes me unofficially "a little bit older."
It also means I'm not at work so have a few moments spare to bang a
question in for discussion.

I've seen correspondence that promotes this include style

<QSomeThing>

over this

<QModule/QSomeThing>

Link for reference: http://comments.gmane.org/gmane.comp.lib.qt.user/3728

Amongst the reasons given are:

 - makes it easier to compile on both Qt4 & 5
 - former style makes it easier to avoid stray include dependencies and
causes compile errors instead of linker errors

That said, the Qt tool chain seems to use the latter style and not the
former.  Also, a bunch of the examples that come with Qt4 definitely
include both styles!  If you look in subsurface Qt source, the dominant
style seems to be the former, except where Qt Designer / UIC have been at
work.  Look at ui_maintab.h as a random example.

Questions:

- should we favour one style over the other?
- will Qt tools be moving to favour first style?
- what is the mechanism which makes <QModule/QSomeThing> create a compile
error rather than a linker squeal with <QSomeThing>?

It's the last question I'm really interested in.

Regards,

Amit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130604/7bc9926b/attachment.html>


More information about the subsurface mailing list