implicit or module-wide @nogc

Basile B. b2.b2.b2.b2.b2.temp.temp.temp at gmx.gmx.gmx.com.com
Wed Jun 13 07:13:45 UTC 2018


On Wednesday, 13 June 2018 at 06:45:27 UTC, Gokhhy wrote:
> Is there a way to define an entire module as @nogc or otherwise 
> make it so I don't have to qualify every single function as 
> @nogc?

---
module module_wide-nogc;

@nogc:

/*
declarations or statements...
*/
---

But this is not considered as a good practice.
1. One can work on the module and miss the global nogc
2. unittest are affected (array literals for example must be 
declared static immutable)
3. it cannot be temporarily canceled.

It depends on the context too. 200 slocs module or 5000 sloc 
module ? for a small one this could be ok.


More information about the Digitalmars-d-learn mailing list