[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C99, declaration after statement

From: Bruno Haible
Subject: Re: C99, declaration after statement
Date: Sat, 24 Sep 2011 14:38:50 +0200
User-agent: KMail/1.13.6 (Linux/; KDE/4.6.0; x86_64; ; )

Hi Jim,

> > About this change of fts.c from 2011-08-18.
> > The declaration of max_entries in line 1339 comes after a statement. Not
> > valid C99.
> s/C99/C89/

Oops, yes. Not valid C89.

> C89 is now more than 12 years old

You meant s/C89/C99/ ?

> I see so much more value in using C99's decl-after-statement feature

Sure decl-after-statement is comfortable, But even without it, you can have a
good code structure, by using braces (compound statements).

> accommodating the oh-so-few relevant compilers that still lack
> support that I have a hard time justifying gnulib's current policy.

The compilers that don't support decl-after-statement that I know of are:

  - gcc 2.95 (still used in some distros, AFAIK).

  - IRIX 6.5 cc
    ("A declaration cannot appear after an executable statement in a block.")

  - HP-UX 10 cc
    ("Unexpected symbol: "int".")

  - Solaris 2.6 cc
    ("syntax error before or at: int")

  - MSVC 9.0, also known as MS Visual Studio 2008, released in 2008
    ("error C2143"). See also

IRIX is among gnulib's usual targets, and MSVC is being added now.

> Do you still object to allowing declarations after statements in gnulib?

Yes, I think if the gnulib user has the benefit of not needing to worry about 
issue, it's a benefit for everyone. It's useful if we can say that all of gnulib
is working with C89.

> If so, can you estimate when you will relax that stance?

It depends on what machines are considered "reasonable portability targets"
and on the compiler vendors. I guess IRIX will be dropped within 5 years,
but MSVC support is likely to be relevant for ca. 8 years or more.

> Here is an alternative to imposing a blanket policy:
>     Allow/encourage use of C99, but heed requests for conversion to C89,
>     if there are any.

I can't agree to this. IMO the comfort for the programmer who contributes to
gnulib is not worth the hassles to people who want to compile the package on
IRIX or with MSVC.

In memoriam Sara Harpman 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]