🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #747

Re: global variables in Modula-2 (was How to make libraries smaller?)

#747
From: Andreas Borchert
Date: Fri, 01 Jun 1990 17:25
26 lines
1766 bytes
rcapener@csulx.weber.edu writes:

> I can see that this makes lots of sense for global types (very similar
> to C's typedef in an #include file), and will indeed work.  But will
> variables be the SAME variables in all the modules that import it, or
> will they be DIFFERENT?  It seems to me that it will be the latter,
> since the storage space will be allocated seperately each and every
> time you compile the object files that import it.  I assume that this
> could be a compiler design issue, but is more likely to be a linker
> problem, but don't know for sure.  Have you tested it with various
> compilers/linkers to see what they all do?  It seems reasonable that
> you may be correct, but then again, is this really defined in the
> language standard?

Import of global variables does not cause any reinstantiation of them.
An import is a reference, not a redeclaration or a copy in the sense
of C's #include.

If you compile a module the compiler allocates space for the global
variables of that module but not for the imported variables.

This is true for all valid Modula-2 compilers.

Andreas Borchert.
borchert@mathematik.uni-ulm.de
borchert@dulruu51.bitnet
Technical Details
Message-ID: <9006011725.AA01147@mathematik.uni-ulm.de>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!nems!mimsy!haven!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!MATHEMATIK.UNI-ULM.DE!borchert

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!nems!mimsy!haven!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!MATHEMATIK.UNI-ULM.DE!borchert
From: borchert@MATHEMATIK.UNI-ULM.DE (Andreas Borchert)
Newsgroups: comp.lang.modula2
Subject: Re: global variables in Modula-2 (was How to make libraries
              smaller?)
Message-ID: <9006011725.AA01147@mathematik.uni-ulm.de>
Date: 1 Jun 90 17:25:16 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: Modula2 List <INFO-M2%UCF1VM.BITNET@PSUVM.PSU.EDU>
Organization: The Internet
Lines: 26