Bitwise logic gmpxx.h problems

Emmanuel Thomé Emmanuel.Thome at
Thu Jul 24 23:03:28 CEST 2008

On Thu, Jul 24, 2008 at 08:26:34PM +0200, Torbjorn Granlund wrote:
> Joppe Bos <jwbos at> writes:
>   I am not an experienced C++ hacker but the problem of these
>   compiler errors are the following lines in gmpxx.h:
>   __GMPZZ_DEFINE_COMPOUND_OPERATOR(operator&=, __gmp_binary_and)
>   __GMPZZ_DEFINE_COMPOUND_OPERATOR(operator|=, __gmp_binary_ior)
>   __GMPZZ_DEFINE_COMPOUND_OPERATOR(operator^=, __gmp_binary_xor)
>   Replacing the double PP and ZZ by single ones solves the problem.
> Do you base this on experiments, or on analysis from reading the code?
> There ought to be a reason for the ZZ variant, they are used just for
> bitwise ops.

perhaps precisely because without the patch you applied, it was wrong to
use the __GMPZ_ and _GMP_ variants ? The only difference between __GMPZZ_
and __GMPZ_ is the definition of compound operator with PODs as
right-hand types (if you follow the macro maze).

I _think_ that with the provided patch, it is safe to do s/ZZ/Z/ here. Or
there's some hidden can of worms somewhere that I haven't seen. Can you
use your cvs tree to track back these lines to their author ?


More information about the gmp-bugs mailing list