From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,147f221051e5a63d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: memory management in Ada: tedious without GC? Date: Sun, 25 May 2008 08:35:02 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <4ddef8bf-b5b1-4d7e-b75b-386cd6c8402c@l17g2000pri.googlegroups.com> <9f2c2db4-d6c1-4cdf-884c-5cbc26ac7701@d1g2000hsg.googlegroups.com> <1qxcw3pphdlek.1jgsfwb7atdmo.dlg@40tude.net> <10j4zhb9ge8ea.156spz1dkc4vb$.dlg@40tude.net> <6z9y05h0wes6$.126fz3zrcxvae$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1211718902 20513 192.74.137.71 (25 May 2008 12:35:02 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 25 May 2008 12:35:02 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:sl3YOT8Vz7SCMURQvYZqOU9EW20= Xref: g2news1.google.com comp.lang.ada:340 Date: 2008-05-25T08:35:02-04:00 List-Id: "Dmitry A. Kazakov" writes: > type X is record > A : Boolean := False; > B : Integer := 1; > C : Boolean := False; > end record; > > May the compiler group A and C and initialize both them by zeroing memory? Yes. > If the initialization order were fixed, that would be illegal to do. No -- it's perfectly legal for the compiler to initialize in any order here, because the order does not affect the semantics (and it's easy for the compiler to prove that). For example, the compiler could lay out the above so that A and C are allocated in the same word, and initialize by "move 1 into B" then "move 0 into A,C". That's true in Ada, and it's also true in this imaginary "Ada with init in decl order rule". - Bob