A unary minus operator was applied to an unsigned type - conversion from 64 Bit to 32 Bit
Vincent Lefevre
vincent at vinc17.net
Tue Sep 3 12:30:31 CEST 2024
On 2024-08-25 10:15:22 +0200, Marc Glisse wrote:
> 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).
Well, GCC also has warnings, such as -Wconversion (though it is
currently broken), for suspicious code, which could be used together
with -Werror.
> 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.
I think that the end user should be able to use such warnings for
*his own code*. So, if possible, public header files should be written
in such a way to avoid warnings provided by well-known compilers.
I don't think that just adding a cast to avoid an implicit conversion
can be regarded as obfuscating the code. On the contrary, IMHO,
an implicit conversion that may change the value is some kind of
obfuscation.
--
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