swarm-support
[Top][All Lists]
Advanced

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

Re: objectiveC/C question


From: Marcus G. Daniels
Subject: Re: objectiveC/C question
Date: 05 Feb 2000 12:39:00 -0800
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "RLR" == Rick Riolo <address@hidden> writes:

RLR> Why without 'static' storage class declaration do all those
RLR> declared nextID's in the different *.m files get treated as one
RLR> storage item at link time?

Most Unix systems provide and use a symbol type of `common'.  It dates
back to common blocks in Fortran, where different modules could share
an area of memory for respective variables, but some modules might
grow it more than others.

So not only do you get a single piece of memory allocated for duplicate
global variables, but the types of those global variables can be
different, too.

I personally avoid using common variables, because when I do it is
usually a mistake, i.e. there's an unintended namespace clash across
module, or delaying decisions about where the variable ought to
physically live.  -fno-common enforces that.

RLR> If that is the case, then does the 'extern' in the above example
RLR> make any difference in this case?  (again, note it is outside of
RLR> any method).

By using extern, you will not introduce common symbols -- just
references. 

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