🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #2132

Re: Lattice and externals

#2132
From: Robin Rosenberg INF
Date: Tue, 14 Nov 1989 18:08
16 lines
1187 bytes
In article <704@crash.cts.com>, wade@pnet01.cts.com (Wade Bickel) writes:
>   I'm using Lattice C and have declared a pointer with the same name in two
> seperate modules.  Neither has the "extern" keyword in front of it, and I'd
> like each to be local to its own module (soon almost all of my modules will
> need such a pointer, and I'd like to avoid naming confusion).
>   When I link the program blink barfs on a "symbol redefined" error.  Should
> this be happening?
>                                                 Thanks -- Wade.

The keyword 'static' serves three purposes.
- it declares the variable as static (default for global variables)
- hides the name from other modules (what you wanted)
- *guarantees* that the variable is initialized (to zero unless value specified)

----------
Robin Rosenberg
Technical Details
Message-ID: <173@ra.abo.fi>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!sunic!tut!ra!rosenber
References: <704@crash.cts.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!sunic!tut!ra!rosenber
From: rosenber@ra.abo.fi (Robin Rosenberg INF)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Lattice and externals
Message-ID: <173@ra.abo.fi>
Date: 14 Nov 89 18:08:27 GMT
References: <704@crash.cts.com>
Organization: Abo Academy, Finland
Lines: 16