> 1) What does it mean to declare a function as static

It means that the function is not visible to code outside the source file in
which it is defined.

> 2) What are the consequences w.r.t the palm in particular

None really.  Its used often because CodeWarrior has a "require function
prototypes" switch which will cause the compiler to complain if a function
doesn't have a separate prototype unless its been declared static.  Its used
to keep people from making stupid mistakes with function visibility.

> 3) Why are so many functions declared static in the palm examples? Are
> these functions kept in a different memory area than if they were not
declared
> static? Is there some speed advantage?

There could be a speed advantage -- since the compiler knows that only other
functions in the source file call the static function, it has the
opportunity to do some further optimizations, if it wished.  CodeWarrior
will sometimes automatically inline static functions if you have the
"auto-inline" switch on -- this can speed up some code, and allows you to
chunk something into functions without having function call overhead when
code is only called from one place.



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to