[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: fossil build failure on riscv64



> Interesting. The multiplication is indeed (commonly understood to be)
> UB, since it's producing a signed result outside the range of its type.

Okay. So can I ask what *is* the correct way to do this:

#include <limits.h>
...
{
   int i = INT_MIN;
   unsigned int u = 0;

  if (i < 0) u=-i;
  ...
}

and be able to rely on (u%10) being non-negative?


Reply to: