Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-06-24 07:29:32


Tan Kwee Heong wrote:

> "Vladimir Prus" <ghost_at_[hidden]> wrote in message
> news:d9dopb$3tg$1_at_sea.gmane.org...
>>
>> 1. As Peter Dimov said (IIRC), exceptions are just non-local goto.
>> In this case, non-local goto is fine.

> I wish to reconcile the information provided from Scott Meyer's More
> Effective C++ Item 15, with that
> of Peter Dimov. Could someone post some URLs/referencess of Peter's
> comments, for my benefit?

This thread:

http://lists.boost.org/MailArchives/boost-users/msg01835.php

might be what Vladimir has in mind. But it's not about performance, and
"non-local goto" isn't quite the term I'd use; exceptions are structured,
they are more like a non-local return.

As for performance, you should always measure and evaluate it in context.
You should also keep in mind that an exception usually does the job of
several returns and if checks, and that the if checks are executed in the
traditional return-based code even as a part of the normal flow.

Of course when you want a local return - one that returns to the immediate
caller - an exception is not the most efficient mechanism.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net