On Friday, 16 May 2025 at 19:19:41 UTC, H. S. Teoh wrote:
For example, how do you negate a ubyte?
Mathematically this is only defined for 0 over the range of ubyte.
Obviously, you can't do this: ``` ubyte a; a -=; ```But writing it as `a = -a;` runs into the same error, for the same reason.Instead, you have to work around it with this baroque periphrasis:``` ubyte a; a = cast(ubyte) -a; ``` Does it make sense?
How about: ``` a *= -1; ``` ?