[Exceptional C++ Style] Fw: Item 11: Try and Catch Me
Kevlin Henney
kevlin at curbralan.com
Wed Dec 1 06:39:12 EST 2004
In message
<3FB59316B1511046AF15127B7DE37F6A019E9390 at mail1.pindarsystems.com>,
David Sykes <d.sykes at pindar.com> writes
>
>It seems to me, then, that the open routine cannot tell if the file is
>essential or secondary, and so can't know whether to throw an exception or
>not.
>If, as has been suggested, there was an exception and non exception method
>then the caller could choose. Having the constructor throw an exception and
>open return fail value would fit the guidelines of exceptions being good for
>constructors and return values emitted by operations that can.
It might also be considered an inconsistent and indecisive design,
trying to please all the people all of the time. Such accommodating
interfaces tend to bloat as well as annoy users with their vague
helpfulness :-) Choice is not of itself a virtue.
Kevlin
--
____________________________________________________________
Kevlin Henney phone: +44 117 942 2990
mailto:kevlin at curbralan.com mobile: +44 7801 073 508
http://www.curbralan.com fax: +44 870 052 2289
Curbralan: Consultancy + Training + Development + Review
____________________________________________________________
More information about the Effective-cpp
mailing list