Regarding nothrow and @safe

Timon Gehr timon.gehr at gmx.ch
Sat Aug 20 11:43:25 PDT 2011


On 08/20/2011 08:25 PM, Sean Eskapp wrote:
> == Quote from Timon Gehr (timon.gehr at gmx.ch)'s article
>> On 08/20/2011 08:18 PM, Sean Eskapp wrote:
>>> bearophile:
>>>> As far as I know they have decided to make memory overflow errors, so they are
>>> not exceptions, you can't catch them. Other people will confirm this or not.
>>>
>>> In this case, how would you go about handling out-of-memory situations? A systems
>>> programming language should certainly give the programmer the option to deal with
>>> this.
>> You can catch errors, if you want to deal with them.
>
> Oops, right. In my mind, exceptions are still anything which can be thrown or
> caught. I need to remember that it has a more specific meaning in D.

But note that you cannot explicitly throw an error from a nothrow 
function. nothrow functions can throw memory exceeded errors or 
assertion failure errors. I don't think they can throw other things.


More information about the Digitalmars-d-learn mailing list