Mail Archives: djgpp/1997/03/13/09:33:24
The first construct, declaring the int variable i within the for loop, is
only legal in C++ not in C. So take a careful look at each of your
'sometime's and you should see that it works in .cc files and in .c files
which you have asked gcc to compile as C++ explicitely but not in normal
C compiles.
Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com
On Wed, 12 Mar 1997, Paul Peavyhouse wrote:
> I have noticed a few inconsistencies with the DJGPP compiler over
> other C compilers I use.
> The first one is that the lines:
>
> for(int i=0; i<256; i++)
> { someFunction(i);
> }
>
> won't compile SOMETIMES (?!?!?!), yet the lines:
>
> int i;
> for (i=0; i<256; i++)
> { someFunction(i);
> }
>
> works everytime...why?
>
> Also, I sometimes get random compiler "parse" errors when I include
> the following code in a program:
>
> char *str;
> if ( (str = getenv("DEM_PATH")) == NULL) {
> printf("\"DEM_PATH\" environment variable not set\n");
> exit(1);
> }
>
> Yet again...WHY?
> I really like the DJGPP compiler (just wish I could make it work under
> MSDEV) and the ease of porting to/fro UNIX/DOS. Makes college life a helluva
> lot easier...but these compiler problems bother me as far as how "compatible"
> DJGPP really is. Anyone have any comments?
>
> PV
>
>
> ______________________________________________________________________________
>
> Paul Peavyhouse
> http://www.cs.montana.edu/~pv
> email: pv AT cs DOT montana DOT edu
> ______________________________________________________________________________
>
- Raw text -