Re: CINT bug handling "operator float()"

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Mon, 10 Aug 2009 12:51:58 -0500


Hi Philip,

This is a known (and complex) deficiency of CINT. It does not handle properly the casting operators (like operator float()).

Cheers,
Philippe.

Philip Rodrigues wrote:
> Hi,
>
> Hi roottalk,
>
> The program below prints the correct output
> "5 5" when run compiled, but I get "5 1.69975e+08" when I run it
> interpreted. It seems that CINT doesn't apply the correct C type
> conversion rules to the result of the "operator float()" function. The
> bug also applies if the class is compiled, but the line "double d =
> ft;" is run in interpreted mode.
>
> We have code wrapping basic types like this in order to handle
> value-error pairs and treat them correctly in arithmetic operations.
>
> Regards,
> Philip
>
>
>
> #include <iostream>
> using namespace std;
>
> class FloatT
> {
> public:
> FloatT(float v) : fVal(v){}
> operator float(){return fVal;}
> private:
> float fVal;
> };
>
> void cint_float()
> {
> FloatT ft(5);
> float f = ft;
> double d = ft;
> cout << f << " " << d << endl;
> }
>
Received on Mon Aug 10 2009 - 19:52:01 CEST

This archive was generated by hypermail 2.2.0 : Mon Aug 10 2009 - 23:50:01 CEST