A unary minus operator was applied to an unsigned type - conversion from 64 Bit to 32 Bit

Torbjörn Granlund tg at gmplib.org
Tue Sep 3 19:24:39 CEST 2024


Marc Glisse <marc.glisse at inria.fr> writes:

  (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)

It is some sort of compiler hackerd game, inventing new warnings.  These
warning naturally become gradually less helpful.

I am certainly not against compiler warnings, but of the many hundred
that each compiler now comes with, perhaps 10 are useful to me.

  > 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.

Personally, I see this as endless chase.

I am not opposed to working around some false warnings.  But any such
workaround has a cost as it makes the code readability worse.

Also, I expect the only C program which will be accepted once this game
is over is the empty file.  (Yes, I know a completely empty file is not
allowed by the standard.  But the program /**/ might work, until
somebody invents and enables the -Wuseless-comment warning.)

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-bugs mailing list