Bitwise logic gmpxx.h problems

Joppe Bos jwbos at
Thu Jul 24 21:38:27 CEST 2008

I based this on some experiments after reading the header file. After
the suggested modifications your code compiles fine; and some test I made
work also ok. Compiling is done with: g++ -Wall foo.c -lgmp

I never realized the ZZ variant are there for the bitwise ops: there must
be a more elegant fix.

Best regards,


On Thu, 24 Jul 2008, 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.
> --
> Torbjörn

More information about the gmp-bugs mailing list