Casting ulong to int with @nogc

Selim Ozel sozel at wpi.edu
Wed Jul 28 17:41:04 UTC 2021


import std.conv:to;

```d
import std.conv:to;

@nogc int
myFunction(ulong number){
return to!int(number);
}
```

Since std.conv.to is a non at nogc myFunction throws a compiler 
error. From a practical perspective length property of arrays 
return ulong. What do you think is a reasonable way of casting 
that into int with no-gc.

Thanks,
Selim


More information about the Digitalmars-d mailing list