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

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri May 15 10:01:32 PDT 2015


On 5/15/15 9:44 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>" 
wrote:
> Ha! Two fools, one thought :-)

It's a nice idea but as Vladimir mentioned expand(), reallocate(), 
free() - all need now to worry about checking two singular values 
instead of one.

Since there's a long-established tradition that reallocate() and free() 
accept a null pointer, we can't (and probably shouldn't) change that. So 
I'm thinking in a way null as a singular value comes for "free".


Andrei



More information about the Digitalmars-d mailing list