On Tue, 3 Sep 2024, Vincent Lefevre wrote:

Well, GCC also has warnings, such as -Wconversion (though it is
currently broken), for suspicious code, which could be used together
with -Werror.

Yes, but -Werror is not enabled by default.

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.

https://learn.microsoft.com/en-us/cpp/build/reference/external-external-headers-diagnostics?view=msvc-170
/external plays a role similar to -isystem with gcc/clang.
There are also various pragmas that can be used around the inclusion of the header.

(For C++, gcc has become much worse than MSVC, its recent optimization-based warnings have false positives all over the place and are almost impossible to work around)

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.

I am not opposed to adding the cast, I was mostly pointing out that the -unsigned issue was well known and the developers declined to make a change in the past.

--
Marc Glisse
_______________________________________________
gmp-bugs mailing list
[email protected]
https://gmplib.org/mailman/listinfo/gmp-bugs

Reply via email to