|
From: Carlos d. M. <cg...@wo...> - 2002-08-07 15:47:41
|
Ioannis Vranos escribi=F3:
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf Of Carlos
> Garc?a del Monte
> Sent: Tuesday, August 06, 2002 3:13 PM
> To: dev-cpp-users-list
> Subject: Re: [Dev-C++] iterating by 2
>
>
> It shall work if it compiles. But when I declare i like you,
> inside a for statement, the compiler reports error due to an
> old fashioned way to declare it, try to declare it before
> the for.
>
> ? What compiler do you have?
> I updated to mingw1.1 (I've Dev 4) Don't say it's older than
> the one with Dev 4!!!
>
>
> But then that error should have been reported.
>
> Or substitute it by a while, and perhaps after you can
> restore the for and see what happens.
> On one of my recent experiments I first used a for, the
> program didn't run and I changed it by a while, and it
> worked (???????), after I used again the for and it worked
> (??????????!!!!!!!!!!!!!!). Obviously the first time you
> made a syntax error. The definition inside a for loop is
> valid ANSI C++ (we are talking about C++ here).
> The program compiled without error nor warnings. No errors,
> I am absolutely sure. I only changed for(counter =3D 0;
> condition; counter++){[...]}
> by counter =3D 0; while(condition);[... counter++];}, and
> back to for[..]. If syntax errors I should have change
> something more, but no more changes than the absolutely
> needed by the fact of changing for by while.
>
> Some times the compiler behaves a little strange, it pass
> over lines don't executing them, or calls functions which
> are not called where it calls them, or makes a for or while
> not work although it is well written..
> Your compiler needs psychiatric evaluation. :)
>
> Or an axe!
>
> Be carfull of file extension like :
> a.c and a.cpp
> if in a i have
> for (int i=3D0;i<19;i++)
> {
> };
> if you save like a.c you are candidate for an error depends
> if the
> compiler takes or not .c file like .cpp
> but if you save like a.cpp your compiler always take this
> statement like
> cpp
>
> I always set C++ and save as cpp Can give problems doing as
> c++ but writting c (and saving as cpp)?
> But I always use c++ and save as cpp, the only I do
> sometimes is using stdio for using FILE * instead of fstream
> (if binary files, yes, I know fstream can do, but...).
>
> Well, I know in C++ you can declare variables when you need
> them, I do it many times, and that it's "supposed" that you
> can do for(int i[...], in fact the report of that error
> surprised me "hey, that's legal, why...?". But that's just
> the behaviour I find.
>
|