gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Atan - what non-constants CAN I pass it?

#145652 - NeX - Mon Nov 19, 2007 11:21 pm

Code:

   int angl=cha[0].x-cha[1].x;
   u16 ang=atan(angl)* 256 / PI;


Error, something about "implicit declaration". Change angl to one or zero, and it works, which I understand. But why won't it let me pass ANY non-constant variable to it? What's going on?
_________________
Strummer or Drummer?.
Or maybe you would rather play with sand? Sandscape is for you in that case.

#145653 - DekuTree64 - Mon Nov 19, 2007 11:29 pm

Maybe you're missing a header? With a constant, the compiler is probably seeing that it's a standard function and skipping the call entirely, replacing it with the final value.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku