I got into a discussion with somebody that tells me that it's not good to do what Qt does with include files because i adopted the same strategy in my code.
Let's use QApplication as an example, when you want to include QApplication then you should do:
#include <QApplication>
QApplication is a file without extension that contains:
#include "qapplication.h"
The only disadvantage is see is that it creates more files in the project. Besides that i think it only has advantages.
So my question is, why is this a good or a bad idea?
I think it is the matter of personal taste, mostly. Different projects use different style. Qt picked up this style.
1) It is basically partially matching the standard library includes without the header extension, although CamelCase. It is different in that regard though that the standard library does not allow these days to use the suffixed version.
2) It could also help with class includes within a header with a different main class. See this example:
#include <QFoo>
where QFoo is defined in qbar.h since the main class is QBar, but there is another class put into the same header.
The only disadvantage is see is that it creates more files in the project.
It does not create more files than needed because these could be generated on the fly like in the Qt Project. In that case, it does not clutter your source tree, and will be put into the build directory, or at least a separate place where it does not get in your way. This is done currently by syncqt in the Qt Project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With