Re: [Fwd: Re: [AD] C++ fix math]

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 8 Aug 2002 at 21:21, Laurence Withers wrote:
> This is not the case. When operating on classes with a binary operator, 
> for instance the '+' operator, it is necessary to use a function 

For an operator, yes this is true.  An operator is also explicit.

float y = 15.6;
float x = cos( y );

I don't see anything about Fix in there.  It's not explicit.

ObjectA x ( 15 );
ObjectB y ( 20 );
ObjectB z = x + y;

This is explicit.  I don't expect SomeOtherCompletelyUnrelatedClass's 
function to be called here.  Hmm maybe this is why the Java creators took 
out implicit conversions and operator overloading...

I've never have had a problem with it though, myself.

Gillius



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/