For example, I have a template file, XxxForm.c, that I
copy every time I create a new form (e.g. "copy XxxForm.c
MainForm.c" or "copy XxxForm.c EditForm.c"). Most
of the routines in this file are marked "static", so
I can have a "static Boolean FormMenuHandler(Word menuID)"
and a "static Boolean FormButtonHandler(Word ctlID)" in each
file. If they were not marked as static, the linker would
complain that the same function is being defined in both
EditForm.c and MainForm.c and I would have to give them
more unique names, like EditFormMenuHandler() and
MainFormButtonHandler() ... but since I don't like having
to edit all these changes each time I copy the template
file, I put static in front and everybody is happy.
This is essentially a way of doing object oriented
programming in C. Consider "static" to be equivilant
of "private" methods in C++ if you like. Only the functions
that need to be visible outside the form "object" don't get
marked as "static".
--
-Richard M. Hartman
[EMAIL PROTECTED]
186,000 mi./sec ... not just a good idea, it's the LAW!
> -----Original Message-----
> From: Gaurav Palvia [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 07, 2000 8:04 AM
> To: [EMAIL PROTECTED]
> Subject: Re: why we use static before a function what is the
> significanceof it
>
>
> what exactly meant by the same source.does it mean that if there r
> two different apps on Palm which has two different functions
> of the same
> name then it will cauuse conflict.if yes then how does it happen
> -----Original Message-----
> From: Eric VERGNAUD <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Friday, January 07, 2000 7:02 PM
> Subject: Re: why we use static before a function what is the
> significanceof
> it
>
>
> >Yes, it avoids possible name conflicts betwwen sources.
> >
> >> De : "Ramel Levin" <[EMAIL PROTECTED]>
> >> R�pondre � : [EMAIL PROTECTED]
> >> Date : Fri, 7 Jan 2000 12:40:54 +0200
> >> � : <[EMAIL PROTECTED]>
> >> Objet : Re: why we use static before a function what is
> the significance
> of it
> >>
> >> It means that this function can only be accesses from the
> same source...
> >> this is good programming behavior so you functions are
> kept "private"
> from
> >> other sources.
> >>
> >> R.
> >>
> >> ----- Original Message -----
> >> From: Gaurav Palvia <[EMAIL PROTECTED]>
> >> To: palm-dev-forum <[EMAIL PROTECTED]>
> >> Sent: Friday, January 07, 2000 12:36 PM
> >> Subject: why we use static before a function what is the
> significance of
> it
> >>
> >>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >
>
>