logical const idea - scratchspace

Alex Rønne Petersen xtzgzorex at gmail.com
Mon May 14 14:06:13 PDT 2012


On 14-05-2012 22:13, Steven Schveighoffer wrote:
> On Mon, 14 May 2012 15:56:37 -0400, Alex Rønne Petersen
> <xtzgzorex at gmail.com> wrote:
>
>> On 14-05-2012 21:51, Steven Schveighoffer wrote:
>
>>> It also should be recommended that the scratch space not contain any GC
>>> pointers, since it's *not* participating in the type system properly,
>>> the GC may not treat it as a pointer.
>>
>> That renders it useless for caching e.g. a string though...
>
> Yes, it does. Unless you know the size of the string (so you can allocate
> enough scratch space to hold it).
>
> It's not perfect, for sure. But it might be better than nothing...
>
> -Steve

But is there any reason we can't just have the GC check the scratch 
space? If it's all zero, it clearly contains nothing of interest, but if 
it's non-zero, just scan it like regular object memory.

-- 
- Alex


More information about the Digitalmars-d mailing list