Memory allocation purity
Meta via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 14 17:56:38 PDT 2014
On Thursday, 15 May 2014 at 00:50:06 UTC, Walter Bright wrote:
> On 5/14/2014 5:03 PM, Meta wrote:
>> Allocating memory through new and malloc should always be
>> pure, I think, because
>> failure either returns null in malloc's case,
>
> malloc cannot be pure if, with the same arguments, it returns
> null sometimes and not other times.
>
>
>> or throws an error in new's case.
>
> A non-recoverable error.
> ^^^^^^^^^^^^^^^
If we pretend that there's infinite memory, then malloc will
never return null.
More information about the Digitalmars-d
mailing list