Hi,

gboolean is a typedef for gint in glib system. The gboolean variables are
supposed to hold only TRUE or FALSE values. Could any one let me know why
the gboolean is typedef'ed as gint? It could be simply typedef'ed for gshort
(in particular gushort) or gchar (in particular guchar) for more efficiency.
Are there any design constraints limiting for this kind of definition? If
not, isn't it needs to be optimized from memory perspective?

Attached below is part of the gboolean definition from glib-documentation.
gboolean

typedef gint   gboolean;

 A standard boolean type. Variables of this type should only contain the
value 
TRUE<file:///usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS>or
FALSE<file:///usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS>.



And TRUE and FALSE are defined as below.
TRUE

#define TRUE    (!FALSE)

 Defines the 
TRUE<file:///usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS>value
for the
gboolean<file:///usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean>type.

FALSE

#define FALSE   (0)

 Defines the 
FALSE<file:///usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS>value
for the
gboolean<file:///usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean>type.

thanks & regards,
uma..
for twincling.


[Non-text portions of this message have been removed]

Reply via email to