Type of USHRT_MAX

Marc Glisse marc.glisse at inria.fr
Sun Jun 9 00:56:34 CEST 2013


Hello,

according to the C standard, USHRT_MAX has type int (or unsigned int if 
short and int have the same size). __GMP_USHRT_MAX has type unsigned 
short. GMP sometimes defines USHRT_MAX as __GMP_USHRT_MAX, and always 
assumes that USHRT_MAX has type unsigned short (in printf in particular). 
This seems to only affect the testsuite, but it would still be nice to 
fix (some compilers give warnings).

Should __GMP_USHRT_MAX be defined to ((unsigned int)current_definition) 
and the 'h' in printf format strings removed, or should USHRT_MAX be cast 
to (unsigned short) where needed? Or something else?

-- 
Marc Glisse


More information about the gmp-bugs mailing list