Challenge: write a reference counted slice that works as much as possible like a built-in slice

deadalnix deadalnix at gmail.com
Tue Nov 9 00:57:08 UTC 2021


On Monday, 8 November 2021 at 22:38:27 UTC, Andrei Alexandrescu 
wrote:
>> I don't think this one is a real problem, as one can cast a 
>> function call to pure and go through this. Dirty as hell, but 
>> done properly it should work even in the face of compiler 
>> optimization based on purity. GCC or LLVM would have no 
>> problem optimizing this scafolding away.
>
> If you cast to pure then same compilers will be within their 
> rights to optimize away calls - because they're pure.
>

I think you might be right here, unless one goes through some 
serious stunt by returning some kind of result that you'd use so 
the compiler cannot optimize it away.


More information about the Digitalmars-d mailing list