|
Boost Users : |
From: Mark Storer (mstorer_at_[hidden])
Date: 2002-09-18 15:44:24
Using exceptions in this way just bugs me. Religious reasons I guess. As
the Esteemed Mr. Hylsop ;) mentioned earlier, exceptions are for "oops".
This seems alot like the whole "do{}while(0)" with various 'break'
statements sprinkled in to avoid multiple returns/nested ifs. Useful, but
Just Not Right.
Your code has cooties! Nobody's going to want to sit next to it during
recess...
>So there's no way to affect feedback to the algorithm's dispatcher
>without actually making modifications to the algorithm code.
So modify away. Seems like a "breath_first_until" sort of thing would be
quite useful. Pass in some sort of predicate, and away you go. I'm sure
the community at large would be grateful.
--Mark Storer
Software Engineer
Cardiff Software
#include <disclaimer>
typedef std::disclaimer<Cardiff> Discard;
-----Original Message-----
From: Chris Russell [mailto:cdr_at_[hidden]]
Sent: Wednesday, September 18, 2002 1:27 PM
To: boost-users_at_[hidden]
Subject: [Boost-Users] Re: [BGL] Best way to abort an algorithm from
withi n a visitor?
> Now if you've got more than a hundred or so entries left to go, exceptions
> really are the greener grass.
>
The size of the graph is not known a-priori (not at coding time anyway) but
is likely to be quite large.
> What's wrong with 'return', perhaps along-side some sort of 'done' status
> variable? I'm only vaguely familiar with the visitor pattern, but these
> would seem to be the obvious choice.
>
See my earlier reply. In this case I'm deriving my visitor from a base and
overriding "event" handlers that receive their marching orders via const
references and return void. So there's no way to affect feedback to the
algorithm's dispatcher without actually making modifications to the
algorithm code.
"Mark Storer" <mstorer_at_[hidden]> wrote in message
news:E840F0B7E6189547BDB91DA8BF2228AB016255F8_at_csmail.cardiff.com...
> If efficiency is your goal, exceptions are not the answer. Just enabling
> exceptions at compile time makes a noticable performance hit. Actually
> throwing an exception can gobble up a 1000 cycles, give or take. That's
per
> throw. If you catch and throw again, you'll pay again.
>
> Now if you've got more than a hundred or so entries left to go, exceptions
> really are the greener grass.
>
> What's wrong with 'return', perhaps along-side some sort of 'done' status
> variable? I'm only vaguely familiar with the vistor pattern, but these
> would seem to be the obvious choice.
>
> --Mark Storer
> Software Engineer
> Cardiff Software
>
> #include <disclaimer>
> typedef std::disclaimer<Cardiff> Discard;
>
Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
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