|
From: Ioannis V. <no...@ho...> - 2002-08-07 08:12:08
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Teodorescu Cristian > Sent: Wednesday, August 07, 2002 10:24 AM > To: Dev-C++ Mailing List > Subject: Re: [Dev-C++] iterating by 2 > > > Ioannis Vranos wrote: > > >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. > > > >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. > > > > > yes i do you do but not everyone and most of them use c++ > features and > write procedural code and they say that that code is write in c > so they save with .c so ... Even if when you write procedural code C and C++ have differences, especially C99 and C++98. > some compilers do mistacke like > borland 3.1 Borland 3.1 is very old. I am talking about post ANSI C++ 1998 standard era. That is for nowadays compilers. > try this in a .c file > int dummy (int & a ) my collegs do and by default the file name is > noname00.cpp compile run ok. > After save in a.c compile error "not ok " and they stay about > 10 min to > figure out until theacher said that they had to rename the file Yes. That's what i am talking about. C and C++ are different. Save C code in .c files and C++ code in .cpp files. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |