issue with Microsoft compiler

Vincent Lefevre vincent at vinc17.net
Mon Feb 13 12:10:24 CET 2023


On 2023-02-13 10:20:07 +0100, Marc Glisse wrote:
> On Mon, 13 Feb 2023, Niels Möller wrote:
> > My view is that GMP simply depends on the required semantics of the C
> > specification. And negating mp_limb_t values is something that's done in
> > lots of places. I'm not aware of any workaround that wouldn't result in
> > an annoying amount of clutter.
> 
> I think changing it in public headers (gmp.h, gmpxx.h) is the important
> part, changing it in internal source files is less of an issue.

This is valid C, not even a coding style error, and this is a rather
common use of unsigned types, and sometimes necessary to avoid
undefined behavior (think of "-LONG_MIN", which needs to be done
in unsigned arithmetic, e.g. "- (unsigned long) LONG_MIN", because
-LONG_MIN is not representable as a signed long).

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list