Re: Re: Optional args in C code.

Joe Knapka <[email protected]> 03 May 2004 16:36:11 -0600
Newsgroups gmane.comp.lang.prothon.devel
Message-ID <[email protected]>
"Mark Hahn" <[email protected]> writes:

> Joe Knapka wrote:
> 
> > Yes there is ("-ansi"), and when I use it, *nothing* in the source
> > tree will build -- because // is not ANSI C, apparently. At least,
> > GCC thinks not.
> >
> > Shall we convert everything to /* comments */ then? Or perhaps
> > we really want the code to conform to ISO C '99, rather
> > than ANSI? (C99 apparently allows variable declarations anywhere,
> > though.) Or is GCC wrong about // comments?
> 
> We should pick a standard and go with it.  I had no idea there was a C
> standard that allowed declarations everywhere.  I'd love to use declarations
> everwhere.  I hate that in C.
> 
> My default VC setup allows // but not embedded declarations.  What standard
> is that?

If I tell GCC to conform to ISO C99 (which is "not fully supported" in
GCC 3.2, according to "man gcc"; so maybe this behavior is erroneous),
I get both C++ // comments and anywhere-decls. I can see no option to
Visual Studio .NET that makes it support C99 (I'm looking at the M$
Library docs for CL).

>  I need to find out if I can get away with embedded declarations in
> my Visual C dev system.  I'm using Visual Net 2003, so it should support the
> latest ansii standards.

Visual Studio seems very focussed on C++ coding and C++ standard
compliance, but I haven't found anything in the docs addressing C
compliance. (This might very well be more a function of the size of
the documentation than of the standards being supported or not. It's
kind of hard to find what I'm looking for.)

It may be simpler to just remove the // comments and go with ANSI
compliance, than to find a more recent standard that VS.NET and GCC
agree about.

> P.S.  I'm modifying builtins-strnig.c right now adding macros and getting it
> to run on windows.  So let me own it for a while.

OK. What did I do (besides decls in strange places) to break Windows
builds?

-- Joe

-- 
Resist the feed.
--
If you really want to get my attention, send mail to
jknapka .at. kneuro .dot. net.