Re: Dumb identifier name question
- From: Owen Taylor <otaylor redhat com>
- To: Robert Graham Merkel <rgmerk mira net>
- Cc: gtk-devel-list gnome org
- Subject: Re: Dumb identifier name question
- Date: Mon, 27 Jan 2003 17:18:13 -0500 (EST)
Robert Graham Merkel <rgmerk mira net> writes:
> Hi all,
>
> I'm currently in the process of implementing a priority queue which I hope
> can be incorporated into glib in the future.
>
> I'm trying to copy the coding style from the gtk library, so I had a look
> at how glib declares its data types. In the process, I noticed something
> that, if I've understood correctly, violates the C standard.
>
> The include guards on the header files are of the form
>
> #ifndef __G_FOO_H__
> #define __G_FOO_H__
>
> /* . . . */
>
> #endif
>
> And the typedefs for glib structure are of the form
>
> typedef struct _GBar GBar;
>
> According to K&R 2nd edition appendix B (p 241), introducing the C
> standard library, "External identifiers that begin with an underscore are
> reserved for use by the library, as are all other identifiers that begin
> with an underscore and an upper-case letter or another underscore".
Basically, it's been this way since 1996, and nobody has run
into a non-theoretical complaint, so we'd rather not:
- break consistency between existing code and new code
Or:
- change 600,000 lines of code to do something different
Since we maintain our namespace in these cases, the chances of collision
are pretty tiny -- larger for GLib (with the _G_ namespace) than for
Pango (_PANGO_( or GTK+ (_GTK_), but still small.
> I realise the practical chances of this causing a problem
> are small, but then again the effort required to fix it is also basically
> janitorial.
Something can be "basically janitorial" and still a huge job.
Not worth doing in the absence of concrete problems.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]