[Exceptional C++ Style] Fw: Item 11: Try and Catch Me

Kevlin Henney kevlin at curbralan.com
Wed Dec 1 10:30:07 EST 2004


In message <057e01c4d7a2$adb74740$1801a8c0 at evaluategroup.local>, Adrian 
Fagg <adrianf at evaluategroup.com> writes
>
>I'd also rather (reluctantly) clutter an interface with extra querying
>functions and throw exceptions for the main ones than return a null pointer
>or whatever to indicate failure.
>e.g.
>  if(thisLot.Has("Jim"))
>    DoIt(thisLot["Jim"]);

I don't necessarily regard this as clutter because the intent is clear 
and explicit rather than ambiguous and hedging, although I might be 
tempted to combine the functions where there is a possibility (1) of 
common use and (2) that something might happen between query and 
command.

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