There simply isn't space to cover all of glib's features in
this book. It's worth looking at glib whenever you find
yourself thinking, "There really
should be a function that..."---glib.h and the glib documentation on
https://www.gtk.org/ are excellent resources.
-
FLOAT_MAX, etc.
equivalents for many numeric types.
-
Byte-order conversions.
-
g_memmove() is more portable
them memmove().
-
G_DIR_SEPARATOR handles
Windows/UNIX differences.
-
G_VA_COPY copies a
va_list in a portable
way.
-
Numerous macros to permit the use of compiler
extensions (especially gcc
extensions) in a portable way.
-
Portable g_htonl() and other
host-to-network conversions.
-
A GCache generic cache
facility.
-
"Callback maintenance" routines---registering and
unregistering of callbacks.
-
The g_log() facility, allows
you to print warnings, messages, etc. with configurable
log levels and pluggable print routines.
-
GMemChunk facility
allows you to allocate a large pool of small memory
chunks, for efficiency gains compared to g_malloc(). Used in the GList implementation, for
example.
-
A timer facility.
-
Convenience/portability routines to get the user's home
directory, get the name of a
/tmp directory, and similar tasks.
-
Filename manipulation, such as
g_basename() and
g_path_is_absolute().
-
Bitfield manipulation.
-
Enhanced string and array classes. Pointer and byte
arrays.
-
GQuark---two way
mapping from strings to integer identifiers.
-
Routines to associate data with strings, or with
arbitrary pointers.
-
A lexical scanner.
-
Tab completions.
-
Calendrical/date-arithmetic functions.
-
A generic event loop abstraction, used to implement
GTK+'s event loop.
-
A portable threads abstraction.
If you need some generally-useful routine that's not in
glib already, consider writing it in glib style and
contributing it to the library! You get free assistance
with design, debugging, and maintenance, and other
programmers benefit from the facility you've written. By
the time you read this, it's also possible that the feature
you want is already in the latest version of glib.