[Geany-devel] struct names / geany macro
nick.treleaven at xxxxx
Mon May 26 12:03:21 UTC 2008
On Sun, 25 May 2008 22:20:01 +0200
Enrico Tröger <enrico.troeger at uvena.de> wrote:
> On Thu, 22 May 2008 18:36:11 +0100, Nick Treleaven
> <nick.treleaven at btinternet.com> wrote:
> > 1. Should we use underscores for struct names? E.g. _GeanyProject. I
> > know GTK uses this, but I've read in C programming books that tag
> > names with a leading underscore should not be used as the compiler
> > uses them. Also it looks a bit ugly. But I don't know if there is a
> > portability reason why GTK uses it.
> I started using the underscores because I thought this is common
> practise (at least I read a lot of code where underscores are used)
> and at some point there were problems if structs and types had the
> same name, so the easiest solution was to prefix the struct name with
Do you remember what problems there were?
> an underscore. Alternatively, we could use a suffix like _s instead.
> But this is a little more ugly ;-). But I don't think using different
> names for structs and types isn't that bad. It helps differencing the
> various symbols.
For the plugin API, in plugindata.h, we often need to use the struct
name, so probably it would be best if we decided on the same
convention. I don't mind using the _Name syntax if using the same name
as the typedef causes problems.
More information about the Devel