Warn about using the GC

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sun Jan 14 12:32:26 UTC 2024


On 15/01/2024 1:25 AM, claptrap wrote:
> On Sunday, 14 January 2024 at 09:45:49 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> On 14/01/2024 10:25 PM, Walter Bright wrote:
>>>
>> ```
>>
>> The transitive nature of ``@nogc`` where it checks function calls is 
>> the only behavior that needs to be disabled. Everything else is good 
>> for such an addition. Although AA mutation and ``.length =`` should 
>> probably be kept. Too easy to do them without realizing it.
>>
>> The goal here is to prevent unnecessary work, that is almost certain 
>> to have been done by accident.
> 
> I couldnt disagree more. That's just one use case, my use case, and 
> anyone doing real time code, is we want to be sure there's no GC calls 
> anywhere in the call graph. It's not just the odd hot loop.
> 
> @nogc not being transitive would be like @safe not being transitive, it 
> would be useless for me.

I am not suggesting modifying ``@nogc``.

It works as required as-is.

But it is not a complete solution that is suitable for all scenarios.

This is not an either/or situation. We can have both solutions as 
different attributes.


More information about the Digitalmars-d mailing list