On 13-08-18 04:24 AM, Colomban Wendling wrote:
Short version: No. Just no.
Le 18/08/2013 09:21, Matthew Brush a écrit :
Hi,
I just want to throw this out there since I already made it:
http://pastebin.geany.org/7YHWE/
It's the diff of a branch which replaces every single redundant G* type with its standard C counterpart. I have a branch with commits for each type, starting from the only one that changed (WRT to recent C99 discussions), but I just pasted here a combination patch of removing all redundantly-named, non-standard C types.
Of note is:
- I left gboolean where it would break a function signature with respect
to GCC warnings.
- I left all guchar, gushort, guint, gulong, etc types, because, lets be
honest, it's just nicer to type.
Nice, we have "int" and "guint"? Come on.
We could use the more common (but not) standard uint or such.
- gpointer (and gconstpointer) was special because it masked the pointer
- behind its typedef and so broke lines with multiple gpointer
declarations on the same line (easily fixable since there's no such thing as void type in C).
- I think patch includes changes to stdint types (ex. gint16, guint32)
but I think we shouldn't change these as GLib assures them and the C99 standard does not in theory (and is not many in use).
int and gint32? Come one.
gint32 is a special fixed-width integer, but we could replace with int32_t (probably reliable with autoconf).
I don't mean to apply this patch directly, just to spur discussion about whether Geany should be using standard C types or pointlessly typedeff'd G* types where there is an existing and cross-platform standard type.
No.
That's constructive.
The one big point I can see against is; "We already do like that", so there's no point in repeating it, it's totally valid and avoids (potentially, although I'm pretty sure not) breaking in obscure ways some mysterious code, but since I made the patch anyways, I'd thought I'd post it for comments. If you see some fundamental issue, of course feel free to point out.
Fundamental issues: uselessness, ugly mix between int, guint, unsigned int, guint32, bool, int, gboolean, etc.
Well I agree about consistency between short, int, long and gshort, gint, glong, but I left basically for your sake to avoid bikeshedding about how guint is so much easier to type than the completely standard since forever 'unsigned'. (or 'unsigned int' if you would).
As I mentioned on IRC, I don't attempt to update Geany's codebase in one fell swoop, just to facilitate use standard C instead of G* stuffs (where it serves no purpose) again.
Cheers, Matthew Brush