RE: [Dev-C++] MinGW 2.95 vs Borland 5.5 compiler
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ya...> - 2002-01-04 21:19:41
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Luigi Santillo > Sent: Friday, January 04, 2002 9:02 PM > To: dev...@li... > Subject: [Dev-C++] MinGW 2.95 vs Borland 5.5 compiler > > > Hello, > > I have both MinGW 2.95 and the Borland 5.5 compiler here are > a couple of > things that > the two compilers manage differently: since my knowledge of > the ANSI C++ is > very limited, I welcome any hints about which one complies > with the ANSI > standard. > > 1) I needed to include the C standard header file "ctype.h" > into a C++ > source file; > should I use:"#include <cctype>" (as MinGW says) or "#include > <ctype>" (as > Borland 5.5 says)? > > Of course I can always use "#include <ctype.h>", but I > suspect that this is > "old" C++. The valid C++ header files for that is <cctype> or <ctype.h>, NOT <ctype>. The difference between the 2 is that anything in <cctype> is defined in namespace std, and in <ctype.h> in the global namespace. Prefer the first. But both are valid ANSI C++. > 2) I need to read a C++ string and the character that comes > just after the > string; > should I assume that: spaces after the string are left on the > stream (as > MinGW says) > or that spaces after the string are extracted and discarded > (as Borland 5.5 > says)? It is as Borland says. In "The C++ Programming Language" 3rd Edition or Special Edition on page 112 it is written: "By default, operator >> skips whitespace (that is spaces, tabs, newlines, e.t.c.)..." So the operator >> of cin reads and ignores whitespace or as your Borland documentation says: "that spaces after the string are extracted and discarded". Notice that we are talking only about the operator >> of cin. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys |