[ODE] Wrong brackets in definition of dSqrt in common.h ?

Rodrigo Hernandez kwizatz at aeongames.com
Wed Dec 14 13:05:35 MST 2005


You are absolutelly right, my guess is that the casts came from someone 
other than Russ, since most people either write their code on C++,
or use the C++ compiler for compiling C code, no one noticed till now.

I noticed that all the macros use the float (not double) versions of the 
functions (IE: sqrtf as opposed to sqrt) those of us still on 32 bit 
machines
would not be affected by just removing the casts, so before I just 
remove them... is there a reason for those casts to be there? It seems 
to me that they're rather redundant.

Cheers!

Peter Onion wrote:

>On Tue, 2005-12-13 at 17:05 -0600, Rodrigo Hernandez wrote:
>  
>
>>Well, thats the problem,
>>I just checked and on UNSTABLE, it is defined as
>>
>>#define dSqrt(x) sqrt(x)
>>
>>and there dont seem to be any castings at all for the other macros, this 
>>is perfectly fine on C,
>>I doubt STABLE is any different, but it may as well be,
>>did you apply any patches?
>>
>>    
>>
>
>Thats Odd, because I just updated my UNSTABLE  and it clearly has 
>#define dSqrt(x) ((float)sqrtf(float(x)))            /* square root */
>
>Hmmmmm... hang on.....
>
>It looks like we are both right....  It depends on dSINGLE or dDOUBLE.
>
>
>Anyway, with dSINGLE defined I think it is still wrong as the C++ style
>casts shouldn't be present in C header files.
>
>Peter
>
>
>
>  
>



More information about the ODE mailing list