Boost logo

Boost Users :

From: Garriss, Michael (michael.garriss_at_[hidden])
Date: 2002-09-19 11:24:25


I agree. I hate to see the return -1 (for example) on some "exceptional"
case in a function when an exception makes more sense. It's not necessarily
an "oops" case, it's an "exception." Either way the caller has to check the
special case. There is a good reason that exceptions are named exceptions
and not errors.
 
Mike Garriss

-----Original Message-----
From: Peter Dimov [mailto:pdimov_at_[hidden]]
Sent: Thursday, September 19, 2002 10:20 AM
To: Boost-Users_at_[hidden]
Subject: Re: [Boost-Users] Re: [BGL] Best way to abort an algorithm from
withi n a visitor?

From: "Mark Storer" <mstorer_at_[hidden]>
> 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.

A common misconception. Many people try to project their own
ideas/expectations on language features, rather than simply using them as
tools where appropriate. There is nothing "oops"-y about exceptions. They
are a control flow mechanism; one that has interesting properties, but a
control flow mechanism nonetheless. If it works and leads to a better code,
it's foolish to avoid it without a technical reason.

A similar example is when people don't use "struct" for C++ classes because
it "doesn't feel right", or when trying to choose between "typename" and
"class" for template parameters. The language features simply do not carry
this kind of religious/emotional payload. It's all in your mind.

Yahoo! Groups Sponsor

ADVERTISEMENT
 
<http://rd.yahoo.com/M=234081.2377872.3808768.2225242/D=egroupweb/S=17050067
88:HM/A=1225247/R=0/*http://ad.doubleclick.net/clk;4547223;7007303;y?http://
www.ameriquestmortgage.com/welcome.html?ad=Yahoo01>
 
<http://us.adserver.yahoo.com/l?M=234081.2377872.3808768.2225242/D=egroupmai
l/S=:HM/A=1225247/rand=147617524>

Info: < http://www.boost.org <http://www.boost.org> >
Wiki: < http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl
<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 the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .

[Non-text portions of this message have been removed]


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