[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Thu, 2002-08-08 at 17:17, Jason Winnebeck wrote:
> Eric Botcazou wrote:
>
> > float c = cos(a);
> >
> > is expanded as:
> >
> > float c = float(cos (fix(a)));
>
>
> What? Excuse me? What compiler is this? That makes no sense. Why
> would it be doing that? cos doesn't even TAKE a fix value. Why would
Yes, that's what confused me also, until I found this in the Allegro
headers:
inline fix cos(fix x) { fix t; t.v = fixcos(x.v); return t; }
I.e., Allegro defines its very own cos function, just with fix types
instead of double. As a C programmer, I don't like this.. but I guess in
C++ it's standard to define all math operators/functions for every
mathematical type. Allegro does not only that though, but apparently
also provides automatic conversion, which leads to the confusion and
isn't good IMO. Maybe a namespace should be put around the cos function?
But I know nothing about this - in any case it would be good to get some
kind of warning in the case I described in the beginning, or make it
work like expected.
--
Elias Pschernig