What the heck am i doing wrong? I'm just trying to create a 8 bit unsigned variable.

monkyyy crazymonkyyy at gmail.com
Sun May 18 15:36:50 UTC 2025


On Sunday, 18 May 2025 at 15:30:39 UTC, H. S. Teoh wrote:
> ```
> import nopromote;
> byte b = 120;
> b = b.np + 5;	// .np overtly marks this as narrow int arithmetic
> b = b.np * 2;   // you're on your own here when this overflows
>
> // Though you should't be using narrow ints if you didn't know 
> how to
> // deal with it properly in the first place.
> ```

```d
     short b=120;
     (b+=5)*=5;
     b.writeln;
```

It will get more and more absurd with ()'s but.... well its there 
already.



More information about the Digitalmars-d-learn mailing list