-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Enrico Tröger wrote:
On Sun, 16 Aug 2009 22:08:00 +0200, Colomban wrote:
Just for my self curiousity about including order: why does it is required? I'm a partisan of the "include all you need, but no more" style, meaning that if I use a symbol, I have to include what defines it. e.g. for sciwrappers.h, I would include glib.h as it uses GLib types and define or include something that defines PLAT_GTK. I don't see any
You want to define things in your code again just to not include a header file?
No, but include the header defining them rather than needing the user to do so.
Single header includes are generally more easy and pretty common. E.g. GTK and GLib do require them since some time. In case of Geany, the overhead which raises by including a bit more than strictly necessary is really really small compared what overhead GTK brings in and so I really don't see any real reason. At least, IMO, the advantages for maintainers and plugin authors are much bigger.
I think I've been misunderstood quite a bit, sorry. No, I'm not against single-header policy, even if I think is cleaner to include only what I need when possible, but for a library (like GTK+), for sure I see the point of one single global header including all others. What I'm against, and what I don't understand, is "missing" includes in headers. I think it is a bit cleaner, easier and less error prone to have each header to be self-sufficient in regard of the including code, i.e. if sciwrappers.h needs geany.h, I think sciwrappers.h should include geany.h itself rather than needing to be included before by the including code. In other words, when I include a header, I care about functionalities it provides (declares), and I won't care about how it is implemented (then what it needs). For example, if I would use foo, I include foo.h, and I wouldn't have to care that the the public Foo structure have a member of the Bar type (defined in bar.h) that I don't use. Hum, I think I should have said "include all you need" without the "but no more" that was only here to say that I wouldn't include *directly* (no care about it is included by what I include) headers I don't need.
But yes, single headers fixes this problem since they include all what it is needed, but I sill think each header should include all what it needs too.
Regards, Colomban