List of Phobos functions that allocate memory?

Walter Bright newshound2 at digitalmars.com
Sat Feb 8 14:13:04 PST 2014


On 2/7/2014 11:53 AM, Jonathan M Davis wrote:
> or to avoid allocating them

Grep for 'throw' in std.datetime shows that every throw is actually:

     throw new ...

and an example:

     throw new DateTimeException("SYSTEMTIME cannot hold dates prior to the year 
1601.");

There is no requirement that the new is done there. You can preallocate the 
DateTimeException statically, and simply keep rethrowing the same exception 
instance.

I.e. the allocation issue is a coding style issue, not a language problem.


More information about the Digitalmars-d mailing list