List of Phobos functions that allocate memory?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Feb 7 16:49:45 PST 2014
On 2/7/14, 8:40 AM, Dmitry Olshansky wrote:
> 07-Feb-2014 06:44, Walter Bright пишет:
>> On 2/6/2014 2:15 PM, Brad Anderson wrote:
>>> Personally I don't think bad user input qualifies as an exceptional
>>> case because
>>> it's expected to happen and the program is expected to handle it (and
>>> let the
>>> user know) when it does. That's just a matter of taste though.
>>
>> It's not a matter of taste. If your input is subject to a DoS attack,
>> don't put exceptions in the control flow.
>
> Meh. If exceptions are such a liability we'd better make them (much)
> faster.
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
More information about the Digitalmars-d
mailing list