From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Discriminated types with default discriminants
Date: 03 Nov 2005 18:08:05 -0500
Date: 2005-11-03T18:08:05-05:00 [thread overview]
Message-ID: <wcc3bmdgwiy.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: U_saf.5294$Rl1.469@newsread1.news.pas.earthlink.net
"Jeffrey R. Carter" <spam@spam.com> writes:
> There are 2 ways the compiler may implement this. Many compilers,
> including GNAT, allocate enough storage for the largest value, and then
> use parts of this storage depending on the current value of the
> discriminant. If the largest value is too big, such a declaration
> results in Storage_Error being raised.
>
> A few compilers will add a level of indirection, and store the
> variable-sized stuff elsewhere, reallocating storage when the amount
> available is not big enough.
It is quite difficult to get the indirect approach to work right.
Think about renaming a subcomponent of the thing, or taking
'Access of a subcomponent. Then the thing moves elsewhere in
the heap when it grows. Bad news! I've seen compiler bugs
in this area.
> As with most implementation decisions, it's a trade off among
> complexity, space, and time.
Indeed.
- Bob
next prev parent reply other threads:[~2005-11-03 23:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-03 15:50 Discriminated types with default discriminants Maciej Sobczak
2005-11-03 16:06 ` Martin Krischik
2005-11-03 23:10 ` Robert A Duff
2005-11-04 5:01 ` Jeffrey R. Carter
2005-11-03 16:21 ` Ed Falis
2005-11-03 17:28 ` Dmitry A. Kazakov
2005-11-03 18:51 ` Jeffrey R. Carter
2005-11-03 23:08 ` Robert A Duff [this message]
2005-11-04 0:08 ` Adam Beneschan
2005-11-29 2:49 ` Randy Brukardt
2005-12-02 18:22 ` Robert A Duff
2005-11-04 9:18 ` Maciej Sobczak
2005-11-04 3:27 ` Brian May
2005-11-04 13:09 ` Stephen Leake
2005-11-04 17:58 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox