Path: utzoo!attcan!uunet!cs.utexas.edu!uwm.edu!uakari.primate.wisc.edu!aplcen!haven!rutgers!att!dptg!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c++ Subject: Re: Another cfront 2.0 enum handling bug Message-ID: <10207@alice.UUCP> Date: 2 Dec 89 15:35:11 GMT References: <1989Dec1.153551.28059@newcastle.ac.uk> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 38 In article <1989Dec1.153551.28059@newcastle.ac.uk>, graham@cabernet.newcastle.ac.uk (Graham D. Parrington) writes: > cout << val1 << "\n"; > When compiled and executed this produces the output: > 0 > However if the line with cout in it is replaced by > cout << "" << val1 << "\n"; > Then the output is the expected: > val1 > What's going on here? It's really puzzling It's the combination of a cfront bug and the fact that cout is not of type `ostream.' Rather, cout is of type `ostream_withassign,' which is derived from `ostream.' The << operator, of course, returns an ostream. Thus if you say ((ostream&) cout) << val1 << "\n"; you'll get the right answer. Of course, cout << "" already returns an ostream so you needn't worry. I imagine the bug will be fixed in 2.1 -- --Andrew Koenig ark@europa.att.com