Discussion about deprecating @nogc and workarounds

Lance Bachmeier no at spam.net
Sat Sep 7 13:06:45 UTC 2024


On Saturday, 7 September 2024 at 08:05:10 UTC, Kapendev wrote:

> BetterC is weird, but it does do something. If `@nogc` were to 
> be removed, BetterC could act as a replacement for those who 
> want to avoid using the gc and enforce that at compile time.

How do you replace this code with BetterC? Answer: You don't.

```
import std;
void main() {
     writeln(add(3, 4));
}
@nogc int add(int x, int y) { return x+y; }
```

The use cases of @nogc and BetterC are very different. With 
BetterC you lose classes, dynamic arrays, and associative arrays, 
among other things.


More information about the Digitalmars-d mailing list