Why does gtk have gint, gdouble... which are just typedef?
Asked Answered
P

1

5

According to the official GTK documentation, gdouble, gchar, etc are just typedef of the normal C types.

What's the point of it ? Why not simply use the traditional name, int, char; why take the trouble to typedef them all and as far as I can see, add nothing to them ?

Photoreceptor answered 22/2, 2017 at 17:48 Comment(0)
I
7

The real reason is lost in time, and has since passed into legend. The types were introduced by the original authors of The GIMP in order to get consistent syntax highlighting in Emacs.

You are absolutely free to use C89, C99, and C11 types in your own code for the types that are simple typedefs. For some other, platform-specific types, like gsize or gint64, it's best to be consistent with what the API you are using expects.

Imperception answered 22/2, 2017 at 18:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.