|
Prev: Anonymity & Object Lifetime
Next: std::ostream oddity
From: Jerry Coffin on 5 Jan 2008 06:33 In article <9ef43128-635c-45cf-9f06-972386d61688 @h11g2000prf.googlegroups.com>, lancediduck(a)nyc.rr.com says... [ ... ] > Isn't it amazing, even 17+ years after publication of the C++ ARM, > that exceptions are STILL a topic of political debate? Not really -- debate over exceptions had been going strong for a long time by the time the ARM was published. TTBOMK, PL/I was the first widespread language to use exceptions, all the way back in 1964, and people have been arguing about them ever since. [ ... ] > The fact is, that the standard library container interfaces were > designed with exceptions in mind. If they weren't, then they would > have looked more like the C library interfaces. Anything that > overloads an operator, relies on constructors, or uses allocators > "underneath the hood" cannot detect errors unless exceptions are > enabled. I think you're overstating things a bit. While I would certainly agree that exceptions are relatively clean, there are alternatives, such as setting global variables to indicate errors (like errno). > Perhaps someone will build a container libary that is suitable for use > without exceptions. And it is possible to make a dialect of any > general purpose language, target it for a particular use, and make it > go faster for that application. But the "you shouldn't have to pay for > what you don't use" is a silly argument to use in the context of > exceptions, since one hopes never to use them in typical practice. It > is like saying "I shouldnt have to pay for fuses since I've never > overloaded a circuit." I disagree -- but I also note that as long as an exception isn't thrown, their price is usually minimal and often nonexistent. As such, you mostly don't pay for what you don't use. Furthermore, the idioms commonly used to make code exception safe also makes the code relatively simple and readable -- in particular, it tends to lead to much greater consistency and commonality, where you otherwise tend to see a great deal of gratuitous variation. -- Later, Jerry. The universe is a figment of its own imagination. [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
|
Pages: 1 Prev: Anonymity & Object Lifetime Next: std::ostream oddity |