comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Elaboration circularity with generics
Date: Mon, 16 Jan 2012 17:25:03 -0500
Date: 2012-01-16T17:25:03-05:00	[thread overview]
Message-ID: <wccipkbwaio.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 2ffd449a-2eee-4127-8cdb-7c42bcfd9e60@a40g2000vbu.googlegroups.com

Maciej Sobczak <see.my.homepage@gmail.com> writes:

> On Jan 16, 3:34�pm, Robert A Duff <bobd...@shell01.TheWorld.com>
> 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



      parent reply	other threads:[~2012-01-16 22:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-14 15:09 Elaboration circularity with generics Maciej Sobczak
2012-01-14 16:13 ` Martin Dowie
2012-01-14 16:17 ` AdaMagica
2012-01-14 22:46   ` Simon Wright
2012-01-15 16:55     ` AdaMagica
2012-01-16 15:09       ` Simon Wright
2012-01-16 17:15         ` AdaMagica
2012-01-14 16:26 ` AdaMagica
2012-01-14 22:01 ` Georg Bauhaus
2012-01-15 17:15   ` Maciej Sobczak
2012-01-15 17:43     ` AdaMagica
2012-01-16 17:02       ` Adam Beneschan
2012-01-16 14:34     ` Robert A Duff
2012-01-16 21:29       ` Maciej Sobczak
2012-01-16 21:52         ` Adam Beneschan
2012-01-16 22:25         ` Robert A Duff [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox