1.2 GLib Naming Conventions


1.2 GLib Naming Conventions

As with many other libraries, GLib has naming rules for consistency and readability:

  • Function names are always in lowercase, with an underscore between each part of the name : g_timer_new() , g_list_append() . In addition, all function names begin with g_ .

  • All functions in a library start with a common prefix. In GLib, this prefix is g_ .

  • Type names contain no underscores, and each component inside starts with a capital letter: GTimer , GList . The names start with G . The notable exceptions to these rules are the elementary types in Section 1.3.

  • If a function operates primarily on a certain type, the prefix of this function corresponds to the type name. For example, the g_timer_* functions work with the GTimer type, and g_list_* functions go with GList .

It sounds more complicated than it is.




The Official GNOME 2 Developers Guide
The Official GNOME 2 Developers Guide
ISBN: 1593270305
EAN: 2147483647
Year: 2004
Pages: 108

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net