operator double() surprise in cxx

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Apr 30 07:43:57 EDT 2004


>>>>> "Benoît" == Benoît Dejean <bnetNOSPAM at ifrance.com> writes:
    >> double l( Py::Float(rect[0]) ); double b( Py::Float(rect[1]) );

    Benoît> everything that looks/tastes/sounds like a function
    Benoît> declaration is (even with parameters.

Interesting.

So you are saying I can do

  double l(1);

because this could not be a function declaration so the double
constructor is called with an integer argument, but in

  double l( Py::Float(rect[0]) );

the compiler thinks I am declaring a function l that takes Py::Float*
as an argument and returns a double?  Hmm.  This line was inside a
class method -- I didn't think you could declare functions in a class
method....

Still confused, but perhaps on the road to enlightenment.

JDH




More information about the Python-list mailing list