Re: Mixing glibc and standard C data types



"Oleg N. Mayboroda" <onm sparc spb su> writes:

> Hello !
> As far as I understand gtk+ is based on glibc. So, glibc data types
                                              ^
                                          GLib  :-)
[ glibc = GNU C library ] 

> (gint, gfloat etc. ...) should be used.
> But in some functions you can find following situation:
> void  gtk_curve_set_vector  (GtkCurve *curve, int veclen, gfloat
> vector[]);
> 
> ^^^           ^^^^^
> There are quite many such functions where glibc and standard basic data
> types is mixed.
> Is there any reason for mixing glibc and standard C types?

The glib types are only cosmetic aliases for the standard C 
types. 

The idea is that since:

 guint32, gboolean, etc have no corresponding standard (pre C-99)
 types.

And

 guchar, guint, gulong are considerably easier to type

Then a lot of types in the GTK+ source code will have 'g' in
front, so we might as well be consistent and have

 typedef int gint;

gint will _always_ be a typedef for int - its not meant to
cover up width differences or anything. 

I no longer use gint, gchar, gfloat, gdouble in my own
projects ... I think they just confuse people, but in GLib 
and GTK+, our standard is to use them consistently. 

But not using them is completely harmeless, and I don't
think it is worth looking for places where they are not
used or filing bugs about it.  

Regards,
                                        Owen 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]