> From: amritha aithal
>
> Also, why is it that all the functions are declared as
> static in Palm OS application???Any special
> significance for doing that????
>

That really has nothing to do with Palm; it is a C question.

Declaring a function static means it can't be called from code that is
defined in another file.  If you want to use multiple .c files and call a
function in one file from another file, then it can't be static.  In that
case, the function is declared in a header file which is shared by all the c
files that use that function.  For a simple application, you may want to
include everything in one file, so you declare the functions static to save
you the trouble of adding a separate header file to declare the functions.

If, by any chance, you happen to be a Pascal programmer, think of it this
way:  The declaration (which is usually in a header file) is what Pascal
referred to as a "forward declaration", which allows for the declaration of
a function to be separated from the definition of that function.

Back to C... If you omit the word static, and there is no header file that
declares the function, then when the compiler encounters the function
definition, it complains.

Note that in a Palm app, the PilotMain() function is *not* declared static.
That is because PilotMain is the main entry point into your code and it is
called by the OS, which is obviously outside of your file.


-- 
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