What is nothrow for?
Michel Fortin
michel.fortin at michelf.com
Fri Apr 25 04:19:42 PDT 2008
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?
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list