Checked vs unchecked exceptions

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 26 23:28:55 PDT 2017


On Monday, 26 June 2017 at 21:00:24 UTC, Guillaume Boucher wrote:
> I would say that the overload without exceptions is the 
> "standard" one.

The C++ assumption is that exceptions are slow. So what the text 
you referenced says is that it provides an alternative mechanism 
for situations where you are testing for failure, e.g. accessing 
something that isn't present to see if it exists. It is a 
performance/convenience alternative.

Although that "nothrow design" is rather clumsy and inconvenient 
since you have to provide the error object yourself as a 
parameter.

>> It is rather clear though that C++ std lib relies heavily on 
>> exceptions.
>
> [Citation needed]

No citation needed. RAII + exceptions has been extensively 
described by Stroustrup as a main code structuring mechanism for 
C++ since the 1980s. Basic data structures like std::vector is 
designed with that in mind. C++ programmers that turn off 
exceptions also have to be careful with many areas of C++ 
std::lib.




More information about the Digitalmars-d mailing list