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

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Fri May 15 18:56:37 PDT 2015


On Friday, 15 May 2015 at 17:01:26 UTC, Andrei Alexandrescu wrote:
> Since there's a long-established tradition that reallocate() 
> and free() accept a null pointer,

Question, is there a strong rationale for this? The usefulness is 
obvious if malloc(0) returns null, but otherwise, attempting to 
free a resource that has never been created usually indicates a 
bug.


More information about the Digitalmars-d mailing list