After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 79633 - Leading underscores in identifiers considered harmful
Leading underscores in identifiers considered harmful
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: .General
2.0.x
Other All
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
: 596031 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-04-23 16:15 UTC by Greg Hudson
Modified: 2013-10-22 09:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Greg Hudson 2002-04-23 16:15:28 UTC
Hi.  I noticed in the GTK 2.0 release notes the following text:

* The GTK+ libraries use an '_' prefix to indicate private symbols that
  must not be used by applications.

Of course, using a leading '_' for internal symbols is hardly unique to
gtk+; it's all over the GNOME source base.  But bugzilla doesn't let me
report a bug against the entire GNOME project, so I will start here.

Identifiers with a leading '_' are reserved by the ANSI C standard for the
C environment for external linkage, or for any use if the '_' is followed
by an uppercase letter or another underscore.  No application or library
(except for the system C library) is allowed to use such symbols, at the
risk of conflicts.

A prefix like "gtk__" would be more sensical.
Comment 1 Owen Taylor 2002-04-23 16:58:26 UTC
We know, we don't care ;-P

 - any other prefix would either be hideously long or
   hideously ugly,    would not make it clear that the namespace 

    gtk__foo ...   this doesn't look sufficiently private
    gtk_private_   too long
    gtkP_foo ....  ugh

   Plus, it's really best not to stick things into the middle,
   since it involves a non-obvious transformation, so you
   really want a prefix to add to the gtk_foo name.

 - We aren't randomly trodding all over the _* namespace
   but only in _ + namespace prefix

 - GTK+ has for a long time used structure names like
   _GtkWidget without any reported problems.

And since these symbols are defined as library private, if 
there is ever a problem we can worry about it then.
Comment 2 Matthias Clasen 2010-01-13 21:06:45 UTC
*** Bug 596031 has been marked as a duplicate of this bug. ***
Comment 3 Markus Elfring 2010-03-28 09:20:18 UTC
(In reply to comment #1)
> And since these symbols are defined as library private, if 
> there is ever a problem we can worry about it then.

I suggest to reconsider your application of name patterns.
https://www.securecoding.cert.org/confluence/display/seccode/DCL37-C.+Do+not+use+identifiers+that+are+reserved+for+the+implementation
Comment 4 Tor Lillqvist 2010-03-28 09:49:37 UTC
We will, as soon as you show a concrete case where the convention causes harm.
Comment 5 Markus Elfring 2010-03-29 08:06:42 UTC
(In reply to comment #4)

Would you like to adjust any identifiers so that they adhere to the rules of the C programming language?

Do you care to avoid any unexpected and unwanted damages by correct software design?
Comment 6 Matthias Clasen 2010-03-29 12:56:58 UTC
comment #1 contains all that needs to be said about this.