A unary minus operator was applied to an unsigned type - conversion from 64 Bit to 32 Bit
Marc Glisse
marc.glisse at inria.fr
Sun Aug 25 10:15:22 CEST 2024
On Fri, 23 Aug 2024, Gerhard Hill wrote:
> WARNING: Type "mp_limb_t" will be converted to "unsigned long", loss of data (loss of precision) is possible.
This is in mpz_get_ui: if you start from a mpz_t and ask for only the low
bits that form an unsigned long, well yes, loss of high bits is possible.
> ERROR: A unary minus operator was applied to an unsigned type. The result is still unsigned.
This one is Microsoft deciding to reject perfectly valid, meaningful,
standard conformant code for "security" reasons because they target
newbies who are unlikely to write a bigint type themselves. You can
disable the Security Development Lifecycle with /sdl- (or look for it in
the menus of visual studio) or you can try something more specific like
/wd4146 (untested).
In both cases, it is possible to obfuscate the code in ways that make the
error/warning disappear on some versions of some compilers, and many
projects do that, but historically that hasn't been GMP's policy.
--
Marc Glisse
More information about the gmp-bugs
mailing list