|
From: Teodorescu C. <te...@xt...> - 2002-08-07 07:22:10
|
Ioannis Vranos wrote:
>>-----Original Message-----
>>From: dev...@li...=20
>>[mailto:dev...@li...] On Behalf=20
>>Of Teodorescu Cristian
>>Sent: Wednesday, August 07, 2002 8:29 AM
>>Cc: dev-cpp-users-list
>>Subject: Re: [Dev-C++] iterating by 2
>>
>>
>>Carlos Garc=EDa del Monte wrote:
>>
>> =20
>>
>>>It shall work if it compiles. But when I declare /i /like=20
>>> =20
>>>
>>you, inside=20
>> =20
>>
>>>a for statement, the compiler reports error due to an old fashioned=20
>>>way to declare it, try to declare it before the for. But then that=20
>>>error should have been reported.
>>> =20
>>>
>>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=20
>>compiler takes or not .c file like .cpp
>>but if you save like a.cpp your compiler always take this=20
>>statement like=20
>>cpp
>> =20
>>
>
>Actually, only with the exception that you use some specific compiler
>treatment switch, a .c file is considered as a C source code and .cpp as
>C++ source code.
>
>
>C & C++ are *different* languages.
>
>
>In ANSI C++ 1998 standard the definition inside a for loop is legal (and
>recommended). In general you can define variables where you first need
>them.
>
>
>In ANSI C 1990 standard you can only define variables at the beginning
>of a scope only.=20
>
>In ANSI C 1999 standard you can define variables as in C++, but the
>language is messy.
>
>
>Anyway when you code in C++ always use .cpp file.
> =20
>
yes i do you do but not everyone and most of them use c++ features and=20
write procedural code and they say that that code is write in c
so they save with .c so ... some compilers do mistacke like borland 3.1=20
try this in a .c file
int dummy (int & a ) my collegs do and by default the file name is=20
noname00.cpp compile run ok.
After save in a.c compile error "not ok " and they stay about 10 min to=20
figure out until theacher said that they had to rename the file
>
>Concerning C, most compilers support (at least by default) C90.
>
>
>Ioannis
>
>* Ioannis Vranos
>* Programming pages: http://www.noicys.cjb.net
>* Alternative URL: http://run.to/noicys
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> =20
>
|