List of Phobos functions that allocate memory?

Dmitry Olshansky dmitry.olsh at gmail.com
Sat Feb 8 03:05:32 PST 2014


08-Feb-2014 15:02, Jakob Ovrum пишет:
> On Saturday, 8 February 2014 at 00:49:46 UTC, Andrei Alexandrescu wrote:
>> One simple idea is to statically allocate the same exception and
>> rethrow it over and over. After all there's no guarantee a distinct
>> exception is thrown every time, and the approach is still memory safe
>> (though it might surprise the programmer who saves a reference to an
>> old exception).
>>
>> Andrei
>
> I don't think it's that simple. What happens if an XException causes
> another XException and they need to be chained together?

If both are thread-local and cached I see no problem whatsoever.
The thing is the current "default" of creating exception is AWFUL.
And D stands for sane defaults and the simple path being good last time 
I checked.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list