[ODE] Wrong brackets in definition of dSqrt in common.h ?
Rodrigo Hernandez
kwizatz at aeongames.com
Wed Dec 14 16:13:29 MST 2005
Jon Watte (ODE) wrote:
>
> Answering more than one message here:
>
>> 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.
>
>
> I beleive they remove warnings from the MSVC 7.1 compiler. Especially
> when passing in literals (like 2.0), that compiler is really anal.
>
That may be the cause :-) I'll have to check.
> > :-) Are you saying I'm awkward and it's my fault because I use a C
> > compiler to compile C ? ROTFL
>
> It's not clear to me that dSqrt() is an officially exported function
> that's intended to be part of the "C" API. However, if it is, then
> yes, the cast needs to be made right. (In fact, even if it isn't, just
> fixing the cast ought to be done)
>
Well, "exported" is too big of a word, its defined in the common.h
header as a macro, and the header is part of the instalation
> The right definition should be sqrtf() for the dSINGLE version and
> sqrt() for the DOUBLE version, if they aren't already, btw.
>
Thats exactly what they are, which is why I find (float)sqrtf(float(x))
to be redundant, in any case, if we are to just avoid warnings the
correct definition should be just sqrtf( (float) x )
> Cheers,
>
> / h+
>
Cheers!
More information about the ODE
mailing list