🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #135

Re: Invalid cast and overload in g++

#135
From: Steve Clamage
Date: Fri, 31 Jul 1992 16:48
31 lines
1389 bytes
afriend@dew.Princeton.EDU (A. Friend) writes:

>Why does g++ choke on these two lines?

>> overload LogSolution();

The keyword 'overload' is obsolete (has been since 1990), and need
not be supported by current compilers.  Get rid of 'overload' keywords
in your code.


>>    istream in = istream(open(savefile, O_RDONLY));

This is not a good way to create a stream object.  Use initialization
by constructor instead:

	istream in(open(savefile, O_RDONLY));

Further, this method of creating an istream is obsolete (assuming you
are using iostreams, rather than the pre-1990 old-style streams).
Probably you should #include <fstream.h> and create an ifstream instead:

	ifstream in(savefile)

It may be that you are using very old code, or have an obsolete C++
textbook.  There are a number of good up-to-date books available.  I
recommend "C++ Primer", 2nd edition, by Stan Lippman, Addison-Wesley.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Technical Details
Message-ID: <1992Jul31.164845.10079@taumet.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!taumet!steve
References: <1992Jul30.141423.22431@Princeton.EDU>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.help,comp.lang.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!taumet!steve
From: steve@taumet.com (Steve Clamage)
Subject: Re: Invalid cast and overload in g++
Message-ID: <1992Jul31.164845.10079@taumet.com>
Organization: TauMetric Corporation
References: <1992Jul30.141423.22431@Princeton.EDU>
Distribution: na
Date: Fri, 31 Jul 1992 16:48:45 GMT
Lines: 31