Problem with __gmp_expr

Ulrich Drepper drepper at
Fri Jan 17 15:30:26 UTC 2014

On Fri, Jan 17, 2014 at 9:27 AM, Marc Glisse <marc.glisse at> wrote:
> Well, expression template libraries all come with a big WARNING sign... This
> part of gmpxx has been this way since its creation (before I learnt C++),
> and people didn't complain that much. std::valarray in gcc's libstdc++
> should have the same issues.

valarray uses references only for constant arguments.  For
non-constant arguments it creates expression objects which in some
situations have to be explicitly casted or assigned.  This is the type
of safety the gmpxx code could use as well.  It is somewhat against
the principals of gmp which allows the knowledgeable user to write
optimized code.

More information about the gmp-bugs mailing list