[Dwarf-Discuss] About self-referencial sized types
Pierre-Marie de Rodat
derodat@adacore.com
Tue Jun 10 09:30:01 GMT 2014
Todd,
On 05/27/2014 06:16 PM, Todd Allen wrote:
> Sorry for the last response on this. But perhaps an example from our Ada
> compiler will help you.
Well, thank you very much for this!
> Anyway, the significant thing is that we're not referencing "n" directly, but
> rather the stored values for the upper bound. If you store the result of
> max(0,n) somewhere, you could reference it directly. For the case of general
> expression upper bounds, you'd have to store the values somewhere (freeze them)
> in case they might produce different results on subsequent evaluations. But I
> don't know if the max(0,n) might be a special case where you don't do that.
That's interesting. Unfortunately, we do not store the value of the
upper bounds in the record (nor anywhere else): the only way to get it
at runtime is to compute it from the discriminants. The discriminants
are the only runtime arguments that can determine the array bounds, so
there is no risk that the bound expressions would produce different
results sometimes.
--
Pierre-Marie de Rodat
More information about the Dwarf-discuss
mailing list