swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is "static" meaningful in Objective-C methods?


From: Marcus G. Daniels
Subject: Re: Is "static" meaningful in Objective-C methods?
Date: 01 Nov 2000 16:13:39 -0800
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "PJ" == Paul E Johnson <address@hidden> writes:

PJ> I'm reading a C book that recommends using static locals in place
PJ> of global variables where possible. Too bad Obj-C methods don't
PJ> allow it.

A static variable in Objective C has the same semantics as a static
variable in C: it is one, fixed piece of memory.

Compared to a global, a static (whether in a method or outside of it)
has advantage of being invisible outside of the .{m,c,cpp} file in
which you define it.  It is just a question of visibility.  If it is
defined in a method, that piece of memory is invisible outside of the
method definition.

Instances variables are what you want if you want different data for
multiple instances of the same class.

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]