
Originally Posted by
akiross
Well, of course headers could be indexed (at least Qt ones), as the code in headers is usually free available.
Indexing is not enough. Consider the two files:
// a.h
#ifdef STH
class Class {};
#endif
// a.h
#ifdef STH
class Class {};
#endif
To copy to clipboard, switch view to plain text mode
// b.h
#ifndef STH
class Class {};
#endif
// b.h
#ifndef STH
class Class {};
#endif
To copy to clipboard, switch view to plain text mode
Which would you include when using "Class"?
Anyway in Qt you can usually include each class separately:
#include <QList>
I really hate the word "usually" here. What if I have my own class called QList, possibly in a separate namespace imported into the main namespace with "using namespace x" that's declared in "mycustomqlistimplementation.h"? What if I had a class "SomeClass" that would really be a define or a typedef to "QString"?
and this kind of inclusion is straightforward to do on a single file, but this may lead to multiple inclusion - but could work for a "light and fast method" when prototyping.
Unfortunately it would backfire for 1) advanced people who know what they are doing and 2) newbie people who have no idea what they are doing. Good software has to work and not "usually work", that's not Windows which usually works.
Bookmarks