[Freeipa-devel] [PATCH 0026] Enable building in C99 mode

Nathaniel McCallum npmccallum at redhat.com
Tue Dec 17 13:47:21 UTC 2013


On Tue, 2013-12-17 at 10:29 +0100, Petr Spacek wrote:
> On 17.12.2013 10:12, Jakub Hrozek wrote:
> > On Tue, Dec 17, 2013 at 08:19:09AM +0100, Jan Cholasta wrote:
> >> Hi,
> >>
> >> On 16.12.2013 22:12, Nathaniel McCallum wrote:
> >>> Patch attached.
> >>
> >> Care to elaborate? There's no ticket or explanation why this is
> >> beneficial or necessary.
> >
> > We had a short chat with Nathaniel yesterday on IRC about which C standards
> > we, as a project, allow. I think this patch is a result of that discussion.
> >
> > SSSD has had -std=gnu99 in the default CFLAGS for more than a year now.
> >
> > I think we can safely support C99 and its features now, it's almost 2014
> > and all major compilers support the features we care about. But I think
> > this change should go hand-in-hand with amending
> > http://www.freeipa.org/page/Coding_Style
> >
> > For instance, would variable-length arrays considered OK? (I would vote
> > yes),
> 
> Please no. You can't catch the error if the memory allocation fails for 
> whatever reason and the process will killed by OS.
> 
> (There is a question if you want to handle memory allocation failures at all, 
> of course.)

I think this can be reasonably be used with appropriately documented
caution.

>  > would intermingled code and declarations be considered OK (I
> > personally dislike these), etc?
> 
> Neither do I :-)

+1, with the exception of declarations at the beginning of the block,
which I find useful (I know this isn't C99).

Features that I don't want to live without:
1. Standard struct initializers
2. Compound literals
3. For-loop declarations
4. Standard bool type

Nathaniel




More information about the Freeipa-devel mailing list