Enrico Tröger schrieb:
On Sun, 16 Aug 2009 23:14:19 +0200, Colomban wrote:
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.
I'm totally with you here, wholeheartedly.
Ok, I got it now. Sorry. Still in Geany itself, first include geany.h, for any plugins just include geanyplugin.h and you are done. Yes, we could change the code so that headers are safer to be included more randomly but who does it?
I do. Because I don't care about the squence. I include the header as I need them, not as the header require it.
Regarding Geany's core code, basically, it is just geany.h which you should include at first. Other headers' order doesn't matter much.
In my first post in this thread I said the order of the includes is important, that is only partly true and with the new geanyplugin.h it isn't true anymore at all because you have only one include and so the order is not important, haha.
But assuming one doesn't use geanyplugin.h and instead includes various headers, the order is important in that way that you:
- first include geany.h
- then include other core Geany header as well as Scintilla and
tagmanager headers if necessary
- finally include pluginmacros.h and geanyfunctions.h
Again, now, just include geanyfunction.h and we don't need to discuss this further.
Btw, say big thanks to Nick who brought us this great header.
Regards, Enrico
I just don't sure what the reason against fine headers which are complete themselves is. IMO, that's good practice.