comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Question about circular elaboration order error (GNAT).
Date: Mon, 14 Apr 2008 09:56:03 -0400
Date: 2008-04-14T09:56:03-04:00	[thread overview]
Message-ID: <wccd4ostua4.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 48028df4$0$19860$4d3efbfe@news.sover.net

"Peter C. Chapin" <pchapin@sover.net> writes:

> Thanks to you and Samuel Tardieu for your replies.

You're welcome.

>...They do help to
> clarify things for me somewhat. It is easy for me to understand how
> Parent.Child's body would have an elaboration dependency on Parent's
> spec, but I did not expect Parent.Child's body to necessarily have an
> elaboration dependency on Parent's body. Are you saying that it doesn't
> (necessarily) have such a dependency in standard Ada, but that I'm
> experiencing an example of GNAT's stricter rules?

Yes.  Your original example (with no pragmas added) is legal, and a
valid Ada compiler (such as GNAT with -gnatE) will compile and link it
just fine.  However, it might fail at run time.  Worst case: it works
fine, but 2 years later, you port it to a new compiler (new machine, or
even a new version of the same compiler), and you get a mysterious
Program_Error.

If you get an elab cycle when you modify your program (e.g., you add a
with_clause), it's easy to deal with -- your change is small, and you
know it caused the cycle.  But if you get a Program_Error when porting a
giant program to a new compiler, it can easily take several hours to
figure out the problem.

- Bob



  reply	other threads:[~2008-04-14 13:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-13 18:12 Question about circular elaboration order error (GNAT) Peter C. Chapin
2008-04-13 19:43 ` Samuel Tardieu
2008-04-13 20:20   ` Robert A Duff
2008-04-13 21:20     ` Samuel Tardieu
2008-04-14 20:21       ` Robert A Duff
2008-04-14 23:36         ` Adam Beneschan
2008-04-15  7:13           ` Georg Bauhaus
2008-04-13 19:46 ` Robert A Duff
2008-04-13 22:49   ` Peter C. Chapin
2008-04-14 13:56     ` Robert A Duff [this message]
2008-04-14 17:33 ` Jeffrey R. Carter
2008-04-14 17:52   ` Robert A Duff
replies disabled

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