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,5f9c25380ec58962 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.197.100 with SMTP id it4mr1771609pbc.2.1326752704939; Mon, 16 Jan 2012 14:25:04 -0800 (PST) Path: lh20ni190064pbb.0!nntp.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!xmission!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Elaboration circularity with generics Date: Mon, 16 Jan 2012 17:25:03 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <583b1bfe-95bd-4669-b16b-c733c81e8f88@w4g2000vbc.googlegroups.com> <1007811599348271064.048391rm-host.bauhaus-maps.arcor.de@news.arcor.de> <9e273746-1663-4fef-9154-f37a25d3c01b@o13g2000vbf.googlegroups.com> <2ffd449a-2eee-4127-8cdb-7c42bcfd9e60@a40g2000vbu.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1326752703 12857 192.74.137.71 (16 Jan 2012 22:25:03 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 16 Jan 2012 22:25:03 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:c3rhVd6oK0Ewx9JOMWM8LT4LU1o= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: 2012-01-16T17:25:03-05:00 List-Id: Maciej Sobczak writes: > On Jan 16, 3:34�pm, Robert A Duff > wrote: > >> > In such a case I would consider it to be a compiler bug. >> >> I don't see any compiler bug here. > > What I'm concerned about is portability. A very legitimate concern! >...If the compiler is allowed to > refuse my program even though there is no paragraph saying that my > program is illegal,... That's not the problem. If your program is legal (I didn't look at it carefully), then all Ada compilers will accept it. In particular, GNAT will accept it in standard-conforming mode. You didn't use the standard-conforming mode. The problem (a language problem) is that in standard-conforming mode, different Ada compilers are allowed to choose different elaboration orders. One order might work, and another order might raise Program_Error. In order to write portable code, you have to sprinkle elaboration control pragmas all over the place (mostly pragma Elaborate_All). And doing that by hand is a super-human task. That's a language problem -- you can't blame any particular Ada compiler. Note that GNAT has a switch that will tell you where to put pragma Elaborate_All. Again, I suggest reading the elaboration section of the GNAT docs -- it explains all this stuff in great detail. >... then perhaps some other compiler will compile it > without any trouble. Which means that my program will not be portable, > even though it might not touch any implementation limits or other > similarly valid reasons. - Bob