std.allocator.allocate(0) -> return null or std.allocator.allocate(1)?

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Fri May 15 13:34:12 PDT 2015


On 05/15/2015 10:13 PM, deadalnix wrote:
> On Friday, 15 May 2015 at 19:49:27 UTC, Andrei Alexandrescu wrote:
>> Well I added the rule that allocate(0) should return null, there are a
>> few more tests but probably nothing worrisome:
>> https://github.com/andralex/phobos/commit/f73f6ecf1b45b0fc3cffd50d375eb15eb2311220
>>
>>
>> Andrei
>
> I do think think this is what makes sense for us:
>   - We should throw in case of error, not return null.

- Too much overhead, there might be a fall-back installed.
- Where do you allocate the exception object?



More information about the Digitalmars-d mailing list