forcing weak purity

Steven Schveighoffer schveiguy at yahoo.com
Wed May 23 04:45:35 PDT 2012


On Tue, 22 May 2012 23:31:59 -0400, Alex Rønne Petersen <alex at lycus.org>  
wrote:

> On 23-05-2012 05:22, Steven Schveighoffer wrote:
>
>> This solution looks crappy to me:
>>
>> void gc_collect(void *unused = null);
>
> BTW, any compiler with alias analysis and LTO might even decide to  
> remove the call even with the unused parameter, since it, well, isn't  
> used. I think we need a language-level solution here.

The LTO would have to be able to make decisions at link time based on  
purity, because the call *does* do things, it just doesn't use the  
parameter.  I have no idea, maybe you are right, it would be a hard  
problem to fix if this happened.

-Steve


More information about the Digitalmars-d mailing list