[Geany-devel] sciwrappers.h not compilable ?

Enrico Tröger enrico.troeger at xxxxx
Sun Aug 16 21:36:29 UTC 2009

On Sun, 16 Aug 2009 23:14:19 +0200, Colomban wrote:

>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.

So, this is what geany.h does and for plugins it's geanyplugin.h.

>> 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.

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?
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.


Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090816/0fef6e2a/attachment.pgp>

More information about the Devel mailing list