Providing implicit conversion of

Gavin Gray gav.gray at gmail.com
Sun Jan 21 16:05:40 UTC 2024


The following code:

   ulong charlie = 11;
   long johnstone = std.algorithm.comparison.max(0, -charlie);
   writeln(format!"johnstone %s"(johnstone));

Results in (without any warning(s)):
johnstone -11

However you choose to look at it, this means -11 > 0 (regardless 
of all arguments concerning implicit conversions, 1's and 2's 
complements, being efficient, etc).

The language should not allow unary unsigned anything.



More information about the Digitalmars-d-learn mailing list