Compiles and core dumps

Stefan Drees sdrees@qwdb.rs.kp.dlr.de
Wed Jan 6 00:30:00 GMT 1999


Hm, 
everyone hates this, but it works for me #:^))
# Reading specs from
# /opt/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.60/specs
# gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
well after I changed the source name to "StreamIt.cpp". So instead 
of telling You about my environment, could it be, that there is a problem
with case, like "streamit.cpp".
Anyway, after an "ifstream maybe("some_name");" it would be nice 
to verify the existence via some code like 
e.g. "if ( maybe.is_open() )", wouldn't it?

Later,
	s t e f a n.

On Tue, 5 Jan 1999, Bruce Eckel wrote:
:-) This compiles fine, but core dumps when you run it (RedHat Linux 5.2,
:-) Reading specs from
:-) /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.92.33/specs
:-) gcc version egcs-2.92.33 19981226 (gcc2 ss-980609 experimental)
:-) 
:-) 
:-) //: C20:StreamIt.cpp
:-) // From Thinking in C++, 2nd Edition
:-) // at http://www.BruceEckel.com
:-) // (c) Bruce Eckel 1999
:-) // Copyright notice in Copyright.txt
:-) // Iterators for istreams and ostreams
:-) #include <iostream>
:-) #include <fstream>
:-) #include <vector>
:-) #include <string>
:-) using namespace std;
:-) 
:-) int main() {
:-)   ifstream in("StreamIt.cpp");
:-)   istream_iterator<string> init(in), end;
:-)   ostream_iterator<string> out(cout, "\n");
:-)   vector<string> vs;
:-)   copy(init, end, back_inserter(vs));
:-)   copy(vs.begin(), vs.end(), out);
:-)   out = vs[0];
:-)   out = "That's all, folks!";
:-) } ///:~
:-) 
---
Day:    Stefan Drees <sdrees@acm.org>, Phone ++49 2203 601 - 3542
Night:  Stefan Drees <sdrees@manchmal.rhein.de>, Phone ++49 228 934 35 14
Browse: http://www.sdrees.de/stefan/




More information about the Gcc-bugs mailing list