[Geany-Devel] Lets move to C99

Matthew Brush mbrush at xxxxx
Sat Aug 17 23:35:51 UTC 2013


On 13-08-17 12:46 PM, Dimitar Zhekov wrote:
> On Sat, 17 Aug 2013 02:19:17 -0700
> Matthew Brush <mbrush at codebrainz.ca> wrote:
>
>>>> Up till now we've tried to stay compatible with ANSI C89 because
>>>> of GTK+-stack doing so (unless I missed the real reason?).
>>>>
>>>> I propose we update to allowing C99 for the following reasons:
>>>>
>>>> [...]
>
> IMHO, Colomban summed up pretty well why there's no compelling reason
> to adopt C99. My 2 euro-cents:
>

I think I missed this summation, will re-read thread.

> 1. Code with gboolean and bool, as well as g_ and non-g_ function
> versions, would be ugly. So, if we are to move, we'd better upgdate
> everything at once. Though it won't be very nice to have glib/gtk+
> callbacks documented as "... gboolean something ...", but implemented
> with "bool".
>

It's a good point. My personal opinion is that we should use "bool" 
everywhere we mean boolean except at the API boundaries of G* where it 
expects an int (ie. gboolean), in which case we should either use 
gboolean or standard "int".

If we do this way, we get the type safety/checking of using _Bool (and 
true/false) instead of int (gboolean and 0/!0 macros) everywhere but we 
can still keep all our g_idle_add() and similar callbacks that are 
expecting ints (gbooleans), without casting the callback function 
pointers and losing type-checking on the other parameters/return type.

At least it's a thought. I'd be interested to see what everyone thinks 
of that.

> 2. If you think that everyone who completed university in the last 14
> years uses C99, that's not quite the case. There were years of time lag
> before all compilers implemented it, and there would be an even larger
> lag until the programs started before the stable C99 implementation are
> re-written or obsoleted - if ever. The business is conservative, and
> does not like to spend money for nothing. On that note, let's cheer for

The smiley face in the sentence you didn't quote but are responding to 
means I was joking/being sarcastic.

> all the programmers using MSVC, pretty much the standard C/C++ compiler
> for Windows: VS moved "closer" to C99! A month ago, that is. :)
>

Neat! For anyone curious:
http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx

Cheers,
Matthew Brush


More information about the Devel mailing list