mpz_get_si: possible undefined behaviour? [Was: Micro-GMP]

Torbjörn Granlund tg at
Wed Dec 5 12:55:15 UTC 2018

  I get your point, but since that assertion can be evaluated at compile
  time, it's cheap enough to add it.

  Systems where LONG_MIN = LONG_MAX may be more common than it seems
  (not that I have personally seen any):

Let's follow these principles:

1. We don't need to support every past and present system. E.g., we
   do not support any 16-bit or 8-bit processors, nor do we support the
   once popular 36-bit systems.

2. We should avoid undefined behaviour which might be relevant only to
   systems we support.  E.g. we might want to avoid signed overflow, or
   conversion between negative signed and unsigned integers.

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list