Boost logo

Boost :

Subject: Re: [boost] Arbitrary precision arithmetic
From: DE (satan66613_at_[hidden])
Date: 2009-08-19 16:31:17


on 19.08.2009 at 9:50
 joel wrote :
> THis may end up as a test case for the general numerical functions
> library I'm trying to generate out of my Boost.SIMD proposal.
> In a large scope, it provides a large number of stub functions that are
> tag dispatched rather efficiently based on "arithmetic"-like value types.
> So basically, it defines 150+ functions that looks at their parameters
> and decide which implementation to use at compile-time. I use that to
> discriminate between scalar and SIMD functions, but if you "tag" this
> bignum class correctly and follow my extension mecanism, then we can
> statically choose between implementation. Roughly :
> bignum<> x;
> bignum<impl::gmp> y;
> x = abs(x); <-- call the "standard bignum" implementation
> y = abs(y); <-- call the GMP implementation

i consider it a poor solution
if i want debug version to use native c++ code and release version to
use a back end i would be forced to type something like

    #ifdef NDEBUG
    typedef bignum<impl::gmp> mybignum; //release
    #elif
    typedef bignum<> mybignum; //debug
    #endif

and to replicate it in every compilation unit

what comes to my mind is for example

   build main.cpp funcs.cpp -dUSE_SPECIFIC_BACK_END -dNDEBUG
   
for release version and

   build main.cpp funcs.cpp
   
for debug version (i hope you got the point)
note that i decide to use it or not by leaving the code unchanged

or
to enable back end explicitly in code i can
#include <bignum/specific_back_end.h>

-- 
Pavel

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk