Re: c compiler: Problems with constants

Glenn Chambers <[email protected]>
Newsgroups gmane.comp.gnu.dotgnu.developer
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.