Header files (Re: A little review of kdecore & kdeui)

David Faure faure at kde.org
Sat Apr 8 00:00:56 BST 2006

On Saturday 08 April 2006 00:42, Harri Porten wrote:
> On Sat, 8 Apr 2006, David Faure wrote:
> >> Considering the time I have already wasted searching my way through the Qt
> >> 4 header files (am I the only one studying headers when trying to
> >> understand compile and runtimer errors?)
> > I don't understand; how could you get an error that points to a one-line 
> > forwarding header? Surely if you get a compiler (or runtime?) error it's
> An example of what I meant by runtime errors: I'm using a container that 
> somehow gets corrupted during execution of my program. Let's say I'm using 
> QList and being a Trolltech deciple I'm using the <QList> header. Now, 
> where do I head looking for the exact definition of the class 
> (documentation does never provide the full truth)? The QList header file, 
> of course. But opening that file in my editor I see that I was wrong and 
> get redirected somewhere else: qlist.h. Nothing that can't be solved by an 
> editor macro but why the detour?
Right, this is why I wrote qt-open-header in the kde-emacs macros.
I see your point of course, but I still think it's only a minor inconvenience
compared to the ease of programming (especially for new developers),
especially since this inconvenience is solvable - and since you would have
to follow the same kind of detour to get to the .cpp anyway.

But anyway it's good if this makes us start using the real docu (I do it more than before, for sure),
then we'll report the bugs/missing items in it rather than letting the 3rd party devels hit those 
problems (and not know what to do then) :)

> Same for compile error: if I spot an error when using KBar my first 
> reaction is look in the documented header for it.
The error you'll get will be from kbar.h so you can just open that one directly;
the jump-to-error feature of your favorite editor, or you copy/pasting the path to
the header, will go to the right place, that's what I meant in my previous mail.

> But independant of that I see the existance of two headers (KFoo and kfoo.h) 
> responsible for the same thing (defining a class) to only cause confusion. 
> Header file redundancy is at least as bad as code duplication ;)
I would compare it more to convenience methods - they, too, forward to the
place where the actual work is being done. It's no actual content duplication, only aliases.

David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list