Topic: IOStreams Operator>> Overloading Conventions


Author: drogers@cs.washington.edu (David Rogers)
Date: Wed, 2 Nov 1994 19:17:36 GMT
Raw View
Subject: Re: IOStream Extraction Operator Conventions

The standard stream extraction operator routines promise to not
write into the destination if the operation fails. This is a
convenient promise. And yet I have seen lots of code that does not
honor this "operator invariant" (convention?).

Do the various implementations out there honor this convention for
built-ins? Does/should this convention apply to all stream
extraction operations? That is, if someone has provided me with a
Fraction class with overloaded stream extraction operators, should
I be surprised if the operation failed and updated the numerator
but not the denominator part of the Fraction instance?

Thanks in advance,
Dave