A New Krazy Checker for #include
Cyrille Berger
cberger at cberger.net
Sun Apr 8 19:31:41 BST 2007
> > Other ideas that I may implement one day (or maybe someone will do me):
> > - if including an installed header, always use #include <foo.h>, not
> > "foo.h" - foo.cpp should always include its own header foo.h first
>
> What is the reason for this?
that way you are certain that "foo.h" can be include in a file without the
need of including an other header. For instance:
foo.h contains:
class myWidget : public QWidget
{};
And in foo.cpp:
#include<QWidget>
#include "foo.h"
build, but each time you want to include foo.h you also have to include
QWidget, it's an easy example, but it's annoying to have to track headers.
So I vote++ on this one :)
--
Cyrille Berger
More information about the kde-core-devel
mailing list