A little warning in GMP.h

Francesco Montorsi f18m_cpp217828 at yahoo.it
Thu Sep 23 12:52:16 CEST 2004


> If so you may wish to know that this warning can be easily turned off by
> adding:
> #ifdef _MSC_VER
> #  pragma warning( disable : 4146 )
> #endif
> at an appropriate point in your code.
well, I've tried to do this but I do not use MSVC only; besides, the code
required to avoid the warning is a little bit more tricky: gmp.h includes
some headers which use MSVC++-specific pragmas to modify warning output and
thus also writing:

 #ifdef _MSC_VER
 #  pragma warning( disable : 4146 )
#include <gmp.h>

does not work; I used to avoid the warning with MSVC:

 #pragma warning(push, 2)
 #include <gmp.h>  // The main include of the GNU Multiple Precision library
 #pragma warning(pop)

Anyway, I was wondering if just writing

      return __gmp_l & (-(signed)(mp_limb_t) (__gmp_n != 0));

would work, since this would solve the problem with all compilers without
any option tweak....

Thanks anyway,
Francesco Montorsi

More information about the gmp-discuss mailing list