[lug] simple iostream bug?

D. Stimits stimits at idcomm.com
Thu Mar 14 16:52:43 MST 2002


Tom Tromey wrote:
> 
> >>>>> ">" == D Stimits <stimits at idcomm.com> writes:
> 
> >> ostream& TextHeader( ostream& web_output )
> >> {
> >>    web_output << "Content-type: text/html\n" << endl;
> >>    return web_output;
> >> }
> 
> This returns a reference to an ostream.
> 
> >>    cout << TextHeader( cout );
> 
> Here you are printing the reference to the ostream.
> 
> Try just:
> 
>     TextHeader (cout);
> 
> instead.
> 
> I don't understand why you see 0xffffffff.  I would expect some other
> value.  Luckily I don't claim to be a C++ wizard.

Yes, that is it, it is printing the address of the reference, but using
some very odd value, I can't imagine 0xffffffff as the valid address of
the reference. This is one of my experiments in streams, I guess I
learned something; unfortunately I designed it wrong compared to what I
had in mind for interchangeable/adjustable/context-sensitive streams,
the 0xffffffff value is just another mystery.

D. Stimits, stimits at idcomm.com

> 
> Tom
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug



More information about the LUG mailing list