comp.lang.ada
 help / color / mirror / Atom feed
From: Nick Roberts <nickroberts@callnetuk.com>
Subject: Re: meaning of "current instance"
Date: 1999/11/13
Date: 1999-11-13T00:00:00+00:00	[thread overview]
Message-ID: <382DB9C1.E3EFFA9E@callnetuk.com> (raw)
In-Reply-To: 2hNW3.1742$dp.68215@typhoon-sf.snfc21.pbi.net

I think the short answer to your question, Tom, is that the order in
which the components of a record type are initialised is not specified
by the Ada 95 standard, and so may vary from compiler to compiler. So if
you have T.J initialised to T.I, say, this may work on compiler A (which
initialises T.I first), and fail on compiler B (which initialises T.J
first). In this respect, your code is said to have an "incorrect order
dependency", which - in Ada 95 - is a bounded error.

One possible way to sidestep the problem is to make T.I a discriminant
(with a default).

   type T (I: Integer := Random(Gen)) is
      record
         J: Integer := I;
      end record;

This discriminant could be hidden by making the above declaration the
private completion of a public declaration of T with no discriminants.

But I'm intrigued as to what you are really trying to do (and why)!

-- 
Nick Roberts
Computer Consultant (UK)
http://www.callnetuk.com/home/nickroberts
http://www.adapower.com/lab/adaos






  parent reply	other threads:[~1999-11-13  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-11  0:00 meaning of "current instance" Matthew Heaney
1999-11-11  0:00 ` Robert A Duff
1999-11-11  0:00   ` Matthew Heaney
1999-11-11  0:00     ` Tucker Taft
1999-11-15  0:00   ` Tucker Taft
1999-11-15  0:00     ` tmoran
1999-11-15  0:00       ` Tucker Taft
1999-11-11  0:00 ` tmoran
1999-11-11  0:00   ` Matthew Heaney
1999-11-12  0:00     ` tmoran
1999-11-11  0:00       ` Matthew Heaney
1999-11-12  0:00         ` tmoran
1999-11-12  0:00           ` Matthew Heaney
1999-11-12  0:00             ` tmoran
1999-11-12  0:00               ` Matthew Heaney
1999-11-13  0:00             ` Robert A Duff
1999-11-13  0:00           ` Nick Roberts [this message]
1999-11-13  0:00             ` Robert A Duff
1999-11-14  0:00               ` tmoran
1999-11-13  0:00                 ` Matthew Heaney
1999-11-15  0:00                   ` John English
1999-11-15  0:00                     ` Matthew Heaney
replies disabled

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