What is nothrow for?
janderson
askme at me.com
Fri Apr 25 08:21:53 PDT 2008
Michel Fortin wrote:
> On 2008-04-25 03:23:39 -0400, Walter Bright <newshound1 at digitalmars.com>
> said:
>
>> Janice Caron wrote:
>>> So I guess my question is, in what circumstance would "nothrow" be
>>> helpful? And is it helpful /enough/ to warrant "polluting" all library
>>> code with "nothrow" annotations?
>>
>> "nothrow" is, as you say, a contract. It specifies that a function
>> must return normally (unless it aborts, crashes, or hangs).
>
> I presume "aborts, crashes, or hangs" should also include "asserts".
> After all, one can't assert in release mode so it doesn't hinder the
> part about better code generation.
>
>
>> 4. destructors cannot throw exceptions (because they are already in
>> one). Andrei has proposed a method to deal with this, but it is as yet
>> unimplemented.
>
> Hum, I wonder, can one assert in a destructor?
>
It shouldn't include asserts. Asserts can be disabled and don't cause
the problems that exceptions do.
-Joel
More information about the Digitalmars-d
mailing list