delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/07/22/18:12:05

Message-ID: <20030722214104.62626.qmail@web13004.mail.yahoo.com>
Date: Tue, 22 Jul 2003 14:41:03 -0700 (PDT)
From: Thomas Tutone <thomas8675309 AT yahoo DOT com>
Subject: Re: Question about the latest GNU C++
To: djgpp AT delorie DOT com
MIME-Version: 1.0

Bill Gerics wrote:

> I have downloaded the latest GNU C++ and noticed 
> some major changes.
 
> 1) Header files no longer have the .h extension

As Sinan points out, the old header files with the .h
extension still exist, but if you use them, you are
not using standard C++, and you if you compile with
warnings on, you will get warnings about doing this.
 
> 2) cin, cout and cerr are no longer supported by 
> the iostream library. I must modify my calls to 
> these functions to std:: cin, std::cout etc--
 
cin, cout, and cerr are most certainly still part of
<iostream>, which is part of the standard library. 
The entire standard library is in namespace std, which
is why you need to add the std qualifier.

> Why are these changes made  

Because that's what the C++ standard has required for
more than 5 years now, as DJ points out.  djgpp
conforms to the standard very closely, which is a good
thing.  Actually, an excellent thing.

> that make my code no longer backwards compatible
> and is there anything I 
> can do to my existing programs to get them to 
> compile short of making the changes mentioned 
> above.  

As Sinan points out, you can still use the old .h
headers, get warnings, and have your old code compile
just fine.  But not all parts of the standard library
are implemented in the old .h headers, and it is not
guaranteed that future releases of gcc and djgpp will
continue to support these deprecated headers (although
I suspect they will remain supported for a number of
years yet).  For those reasons, with any new code you
write, the best practice is to conform to the standard
and not use the old .h headers.

> It would seem that these changes have 
> made existing C++ literature and examples obsolete.

Well, the C++ literature that you own certainly
_sounds_ obsolete.  If you want something current, buy
a copy of Stroustrup's The C++ Programming Language
(3d Ed.), which was published in 1997, when the C++
standard was finalized, and correctly describes
standard C++.  If you have something more recent that
fails to conform to the standard, return it and get
your money back, because they've ripped you off.

I'm curious - what book are you using, what year was
it published?

Best regards,

Tom
















__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019