default random object?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Feb 14 13:35:33 PST 2009


Derek Parnell wrote:
> On Sat, 14 Feb 2009 19:07:52 +0200, Yigal Chripun wrote:
> 
> 
>> I see.
>> Having 3 functions: malloc(), expand() and free() is indeed a very good 
>> design.
> 
> Unless you need to contract the allocated memory ;-) I believe that
> realloc() does expansions and contractions, no?
> 

expand() is a poorly-chosen name. People who are criticizing C's 
allocation API really mean reallocInPlace. Then realloc() can be 
implemented in terms of malloc, free, and reallocInPlace as a 
convenience function.

Andrei



More information about the Digitalmars-d mailing list