Aw: Re: A unary minus operator was applied to an unsigned type - conversion from 64 Bit to 32 Bit
Gerhard Hill
hillgerhard at web.de
Tue Sep 3 10:56:34 CEST 2024
Bonjour Marc,
merci encore pour votre réponse à mon problème d'utiliser GMP et MPFR. Avec vos indications j'ai réussi à traduire mon projet. Il me restent encore quelques questions concernant l'utilisation de MPIR et MPFR, mais je crois que devrais les présenter à un membre du team MPFR. Merci pour votre aide estimée.
Meilleures salutations,
Gerhard Hill
> Gesendet: Sonntag, 25. August 2024 um 10:15 Uhr
> Von: "Marc Glisse" <marc.glisse at inria.fr>
> An: "Gerhard Hill" <hillgerhard at web.de>
> Cc: gmp-bugs at gmplib.org
> Betreff: Re: A unary minus operator was applied to an unsigned type - conversion from 64 Bit to 32 Bit
>
> 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