no-pointer areas

Bruno Medeiros brunodomedeiros+spam at com.gmail
Tue Oct 24 17:38:31 PDT 2006


Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Craig Black schrieb am 2006-10-23:
>> Overall a very, very good idea.
>> However, why does the bytes allocated per element have to be the 
>> qualification?
>> This seems a bit convoluted to me. Why not just add a parameter with a 
>> default value?
>>
>> void *malloc(size_t size, int hasPtr = 1);
> 
> That's what malloc_no_ptr was meant for, using a default parameter
> might be more useful though. Using int seems strange, how about:
> 
> void *malloc(size_t size, bool hasPtr = true);
> 
> Bytes per element doesn't require any cooperation by the compiler.
> Naturally the compiler could take advantage later on and use the
> no-pointer functions.
> 
> Thomas
> 

Huh? Isn't it so that calls to malloc/calloc are already not scanned by 
the GC (besides also not being GC managed), and only when 
addRoots/addRange is used on such segments are they scanned by the GC?

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list