issue with Microsoft compiler
Marc Glisse
marc.glisse at inria.fr
Mon Feb 13 09:15:39 CET 2023
On Mon, 13 Feb 2023, Paul Zimmermann wrote:
> Hi,
>
> someone reported to me the following issue:
>
> Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31937 for x64
>
> will not compile line 2230 in gmp.h:
>
> *__gmp_rp = (- *__gmp_up) & GMP_NUMB_MASK;
>
> giving error C4146: unary minus operator applied to unsigned type,
> result still unsigned.
>
> Just in case this warning can be avoided.
It has been doing that for a long time, for instance
https://gmplib.org/list-archives/gmp-discuss/2004-September/001332.html
and with some options (like /sdl ?) it is turned into an error. It may be
that /external:someoption helps disable it without disabling warnings for
the user's code.
It is certainly possible to avoid the warning, either with a pragma or
with different code, but until now, the policy has been to tell people to
disable this non-sensical behavior in visual studio or use a better
compiler. I don't have a strong opinion here.
--
Marc Glisse
More information about the gmp-bugs
mailing list