issue with Microsoft compiler

Marc Glisse marc.glisse at inria.fr
Mon Feb 13 10:20:07 CET 2023


On Mon, 13 Feb 2023, Niels Möller wrote:

> Marc Glisse <marc.glisse at inria.fr> writes:
>
>> 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.
>
> 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.

> And in general, I'd say that whoever decides to add something like
> -Werror (turn all warnings into compile errors) to the compiler flags
> get's to deal with the work of suppressing any false positives.

To be fair, it is often not the user who enables /WX but the Visual Studio 
IDE that enables /SDL by default, which turns some warnings that Microsoft 
deems relevant to security into errors. And Microsoft's reply in bug 
reports is "disable this option if you don't like it".

-- 
Marc Glisse


More information about the gmp-bugs mailing list