[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]c compiler: Problems with constants
From: |
Glenn Chambers |
Subject: |
Re: [DotGNU]c compiler: Problems with constants |
Date: |
Tue, 23 Mar 2004 21:02:10 -0500 |
On Tuesday, March 23, 2004, at 08:56 AM, Michal Moskal wrote:
On Tue, Mar 23, 2004 at 07:38:10PM +1000, Rhys Weatherley wrote:
Traditional ANSI C only allows declarations at the head of a block.
C++
allows them anywhere in a block. The latest version of gcc follows
the C++
model. Until recently, such code was considered invalid in C.
I believe this is C99 model, not C++ one.
It's also the C++ model. Rhys' comment "Until recently" refers to the
C99
change. I believe that C++ did it first, and C99 added it later.
(Rhys again)
I personally think that it *should* be invalid because it causes
sloppy coders
to write C code that won't compile on most of the world's existing C
compilers, harming code portability in the process. This is why I do
most of
my development with gcc 2.x, not gcc 3.x - the resulting C code is
more
portable.
Since there's no significant C++ element to PNET, this is a reasonable
position.
(The 3.x C++ compilers have a *vastly* more complete C++ library
implementation.)
You should probably do a test build every once in a while with a recent
3.x
just to be sure; the newer compilers have tightened up certain
restrictions
in the language. (see the flamage on 'strict type aliasing checks' on
the
GCC lists about a year or so back.)
(Michal this time)
<flame>Another thing to think about is that C99 is ergh.. 5 years old,
so maybe there is little point in supporting ancient compilers
:-)</flame>
GCC only recently gave up on being buildable with a K&R compiler, and
those
were 'obsolete' when some of the people on this list were born...
Glenn Chambers
Toledo, OH