We'd better stop the thread hijack soon...

Catching exceptions for "exceptional" cases makes complete sense, as
does putting try / catch blocks around plugins which may throw.

My main concern was for using exceptions as a general error returning
mechanism.

The example above of code translating cases into -1, -2, etc. does show
how return values can be abused and/or not handled.  But the same thing
can be done with exceptions.  I've seen plenty of code which catches
the two types of exceptions it understands and converts all others to
CExceptionGenericFailure or the like.

I guess the real problem with exceptions used for error returns is that
all code needs to be written to clean itself up properly with a
combination of destructors hit in exception caused stack unwinding, and
in the catch block.  And since functions usually aren't marked
(properly) as throwing, you have to assume that every single call could
throw an exception.

The mindset needed to make that work well is difficult to attain,
especially with a varied set of programmers.  Handling function returns
(hopefully functions named to specify their returns) with a reasonable
but simple range of defined returns is something humans seem able to do
much better.

...okay, enough of the thread hijack, back to you...


-- 
Tarn
------------------------------------------------------------------------
Tarn's Profile: http://forums.slimdevices.com/member.php?userid=7414
View this thread: http://forums.slimdevices.com/showthread.php?t=29971

_______________________________________________
beta mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/beta

Reply via email to