Xref: news2.mv.net comp.os.msdos.djgpp:5352 From: Tom Wheeley Newsgroups: comp.os.msdos.djgpp Subject: Re: Does DJGPP conform to ANSI-C standards with the for () ? Date: Mon, 24 Jun 96 21:09:06 GMT Organization: City Zen FM Lines: 51 Message-ID: <835650546snz@tsys.demon.co.uk> References: <01BB6054 DOT A8EF6040 AT hf2rules DOT res DOT jhu DOT edu DOT res DOT jhu DOT edu> <4qibc1$434 AT news DOT inc DOT net> Reply-To: tomw AT tsys DOT demon DOT co DOT uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <4qibc1$434 AT news DOT inc DOT net> nelson AT cs DOT uwp DOT edu "Jeremy Nelson" writes: > This is not valid C code for at least several reasons: > > 1) main must return int. void is not acceptable. True > 2) main must take either void parameters or an int and a char **. > an undefined param list is not acceptable. Are you sure? I was under the impression that it was allowed by the ANSI standard due to the large amount of code which would become undefined. Thus the smallest strictly conforming program is main(){} > 3) 'int i' is not valid in the declaration portion of a for loop. > this is valid c++ code, but not valid c. True. Original poster: did you try compiling with gxx ? > The compiler is well within its rights to reject your program > for any of these three reasons, but gcc only rejects because of #3: > > test.c: In function `main': > test.c:3: syntax error before `int' > test.c:3: `i' undeclared (first use this function) > test.c:3: (Each undeclared identifier is reported only once > test.c:3: for each function it appears in.) > test.c:3: syntax error before `)' > > > >void main() > >{ > > int i; > > for (i=0; i<100; i++); > >} > > > >....but all the same. > > Odd -- it compiled for me. Could you elaborate *specifically* as to the > error messages you got? yeah, it looks fine. ..splitbung -- * TQ 1.0 * The 'Just So Quotes'. James Bond asked his ATT rep for a source licence to "kill".