[Info-vax] Possible C compiler static variable initialization problem.
Bob Koehler
koehler at eisner.nospam.encompasserve.org
Thu Feb 27 09:13:59 EST 2014
In article <530e634b$0$61545$c3e8da3$f017e9df at news.astraweb.com>, JF Mezei <jfmezei.spamnot at vaxination.ca> writes:
> I was under the impression that variables defined in a file outside a
> function were local to that compilation unit, but available to all
> fundtions within that compilation unit.
>
> if you use "global" or "extern" when defining the variable, then this
> causes the variable name to be published to the linker to allow the
> variable storage to be shared between all object modules being linked
> into the executable. If I remember, global defined the storage, extern
> told the compiler that storage was defined by someone else and to let
> the linker resolve it.
>
> Is this correct ? Or am I off ?
I believe they are global unless declared static. IIRC there is no
such keyowrd as "global" in standard C.
More information about the Info-vax
mailing list