🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

I don't understand "operator void*()"

#174
From: Jason Rosenberg
Date: Fri, 04 Sep 1992 00:52
33 lines
1628 bytes
I have a variable outStream declared as:

ostream outStream

When I try to do the comparison:  (outStream == cout)

It seems to return true when it shouldn't.  But what confuses me is that there
really is no operator == for the stream types (derived from ios), but what 
seems to get called while stepping through the debugger (gdb 4.4) is:

ios::operator void*()

I just don't understand why this operator is called.  Is the operator void*()
a default operator for when the operator requested isn't found?  How would
one make an explicit call to such an operator?

It could be that gdb simply isn't showing me the whole picture.  All I know
is that when I set the breakpoint at the line with the comparison above and
then step, the first place it stops at is the ios::operator void*().

Please enlighten me.

I know there are probably other things wrong with my code, but I just can't
seem to understand the current dilemna.


Jason


-- 
Jason Rosenberg                           Computer Science Department
jason@cs.ucla.edu                         University of California
{uunet,rutgers,ucbvax}!ucla-cs!jason      Los Angeles, CA  90024
Technical Details
Message-ID: <1992Sep4.005204.12632@cs.ucla.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ucla-cs!lanai.cs.ucla.edu!jason

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.help
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ucla-cs!lanai.cs.ucla.edu!jason
From: jason@lanai.cs.ucla.edu (Jason Rosenberg)
Subject: I don't understand "operator void*()"
Message-ID: <1992Sep4.005204.12632@cs.ucla.edu>
Originator: jason@lanai.cs.ucla.edu
Sender: usenet@cs.ucla.edu (Mr Usenet)
Nntp-Posting-Host: lanai.cs.ucla.edu
Organization: UCLA Computer Science Department
Date: Fri, 4 Sep 92 00:52:04 GMT
Lines: 33