You are not logged in.
Pages: 1
No, no reason at all and it's one of my many annoyances with GTK trying to reinvent the wheel, but by not changing it at all, they only add confusion.
The relevant line from that link:
Types which correspond exactly to standard C types, but are included for completeness - gchar, gint, gshort, glong, gfloat, gdouble.
Or, the other relevant line that just makes my head hurt:
typedef int gint;
This adds no functionality, no options, no anything. It's just branding at the cost of clarity (and an extra character).
Last edited by Trilby (2012-08-29 11:47:48)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
seriously? I mean they must have had some kind of reason to do this. I can't imagine that a dozen of gnome devs agree "yeah, let's prefix everything with a g for no reason, that's totally awesome and cool!"
... or are the gnome devs actually as retarded as some people claim?
Offline
I can't imagine that a dozen of gnome devs agree "yeah, let's prefix everything with a g for no reason, that's totally awesome and cool!"
It's a good thing KDE would never do anything so ridiculous! /s
Offline
moderator comment: Behave guys ...
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
It's a way to support future changes if they are ever needed.
This way they can change the implementation details of a gint or any other g_type and it will not affect a program if it always uses those types.
Pretty simple logic. The only "problem" is that currently they are just alias to the same type
Last edited by Diaz (2012-08-31 22:29:15)
Offline
It's a way to support future changes if they are ever needed.
This way they can change the implementation details of a gint or any other g_type and it will not affect a program if it always uses those types.
Well, not if you do "gint main()". UB waiting to happen.
BTW, my last post was in jest, not meant to foment controversy. Sorry if it came across wrong.
Offline
This is actually a very common thing to do.
By creating aliases like that, if they ever need to change a type, say from int32 to int64 in the future, it can be done on a single line, instead of running a find-and-replace on every file in the code base, not to mention every application targeting GTK.
Offline
But are there cases (in which one could use gtk) where main should return something other than an int? If one uses "gint main()" and at some point gtk changes the definition of gint, that program will no longer compile. Main needs to return an int. So by using "gint main()" you need to assume that gint will always just be int, or that you program may fail to compile.
Last edited by Trilby (2012-09-01 21:45:19)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
But are there cases (in which one could use gtk) where main should return something other than an int? If one uses "gint main()" and at some point gtk changes the definition of gint, that program will no longer compile. Main needs to return an int. So by using "gint main()" you need to assume that gint will always just be int, or that you program may fail to compile.
Thats a good point.
I'm not convinced that it actually should be gint in that case
Offline
I don't have so much of a problem with having a gint type (though it is fun to poke fun at) but the gint main is what I really see as off.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Actually that seems weird
Offline
Pages: 1