Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!rpi!dali.cs.montana.edu!milton!ogicse!pdxgate!parsely!percy!qiclab!m2xenix!news From: news@m2xenix.psg.com (Randy Bush) Newsgroups: comp.lang.modula2 Subject: Re: Initialisation code: When is it called? Message-ID: <1991Jan31.043344.12989@m2xenix.psg.com> Date: 31 Jan 91 04:33:44 GMT References: Organization: Pacific Systems Group, Portland Oregon US Lines: 44 RW_GRIFFITHS@VAX.ACS.OPEN.AC.UK writes: > Finally there is another rare case hen compilers can produce different > initialization orders for the same program. This occurs when a module is > imported into a definition module and then not used in the corresponding > implementationmodule. In such cases some compilers do not initialize the > imported module. Given the following example, should we consider such programs Modula-2 compilers? DEFINITION MODULE A; EXPORT QUALIFIED p; PROCEDURE p () : CARDINAL; END A. IMPLEMENTATION MODULE A; VAR v : CARDINAL; PROCEDURE p () : CARDINAL; BEGIN RETURN (v) END p; BEGIN v := 42 END A. DEFINITION MODULE B; IMPORT A; EXPORT p; CONST p = A.p; END B. IMPLEMENTATION MODULE B; END B. MODULE Test; IMPORT B; BEGIN REPEAT UNTIL B.p() = 42 END Test. -- ..!{uunet,qiclab,intelhf,bucket}!m2xenix!news