Casting an expression to bool means testing for 0 or !=0 for arithmetic types

Jason Spencer spencer8 at sbcglobal.net
Sun Aug 1 07:36:27 PDT 2010


== Quote from Jonathan M Davis (jmdavisprog at gmail.com)'s article
> For logic errors, efficiency isn't really an issue, since they
> shouldn't be happening. If they are, go fix your code and it won't
> be an issue.

That gets less true as the cost of a try block goes up.  Even if logic
errors never occur, the infrastructure to check for them costs you
something.  Ever compared the performance of a program w/ and w/o
trys?

So, would you advocate for exceptions as the sole error reporting
mechanism?  Return values are just for valid result values and
everything else is an exception?  Where do you personally draw the
line?

Jason


More information about the Digitalmars-d-learn mailing list