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

Marco Bodrato bodrato at mail.dm.unipi.it
Sun Dec 9 19:14:17 UTC 2018


Ciao,

Il Dom, 9 Dicembre 2018 3:07 pm, Torbjörn Granlund ha scritto:
> "Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:

> Aside from maintenance, I also don't consider untested code as working
> code.  If we e.g., "support" one's complement integers, then we make
> some sort of claim that it works.  But even if it works by chance one

I agree, we should not claim that we "support" one's complement integer,
if we do neither have a single configuration to test if the claim makes
sense.

On the other side, I think that if we wrote and use a GMP_NEG_CAST macro
for negatives-to-unsigned-positives casts, that is probably not needed for
most compilers... than we shall also write a GMP_UNSIGNEDTONEG_CAST macro
handling the reverse unsigned-to-signed-negatives casts, taking care, if
not too complex, of all the representations the standard allows.

> That construct should be testable by means of asl.h.

Right, we should add an --enable-asl=## option to configure, and start
checking which parts of the library already support exotic sizes and which
parts may need to get generalised.

Ĝis,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list