Hi James,

You are absolutely right. I know about static
functions ,but after seeing the sample code and
tutorials, I started wondering if there was any
significance attached to the word static in Palm
programming.I had this question from day one of my
palm Programming career,but dared not to ask thinking
it's silly question.

Anyway,Thanks a lot guys for your time.
It gave me lots of info.

Amritha.

 --- James <[EMAIL PROTECTED]> wrote: > I think
the person who asked about this knows what a
> static function is, he
> just wanted to know why a lot of palm code uses them
> a lot.
> 
> So actually it does have to do with palm.  They
> answer is in the archives,
> but here "my" answer.
> 
> From what I hear older version of CW (this is stuff
> that I just remember
> reading from the list) use to give some kind of
> warning/error if certain
> function were not static.  People just still do it
> for no reason.
> 
> Here are a couple of people's explanations
>
http://groups.yahoo.com/group/palm-dev-forum/message/44582
>
http://groups.yahoo.com/group/palm-dev-forum/message/48185
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
>
[mailto:[EMAIL PROTECTED]]On
> Behalf Of Richard
> Burmeister
> Sent: Friday, July 20, 2001 12:38 PM
> To: Palm Developer Forum
> Subject: RE: How does HotSync Manager extract info
> from CondCfg.exe?
> 
> 
> > 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/
> 
> 
>
_________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at
> http://mail.yahoo.com
> 
> 
> -- 
> For information on using the Palm Developer Forums,
> or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/ 

=====
There are no rainbows without rain 
There are no victories without pain.

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

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