[PING^2] ada: Add limitations on the acceptable prefixes of 'Old
Robert Dewar
dewar@adacore.com
Wed May 7 10:11:00 GMT 2008
Samuel Tardieu wrote:
> On 7/05, Samuel Tardieu wrote:
>
> | Legality rules preventing "out" parameters to be read before they are
> | initialized do not exist because some cases would be undecidable. So
> | reading "out" parameters is legal, and the compiler cannot do anything
> | but warn about it even if it knows it is incorrect in some cases. But
> | here, taking 'Old on an "out" parameter always refers to an uninitialized
> | variable and can never be correct. This is why I think it deserves a
> | legality rule, as simple as "'Old cannot be applied to OUT mode
> | parameters".
>
> I withdraw this one, as we might end up with 'Old being applied to an
> expression (such as a function call) referring to an out mode parameter
> anyway.
>
> But I'm still in favour of keeping item 4 (formal default expression).
I don't really see why, the rules of use of formal default expressions
are clear, there are useful uses of this, I just don't get why there
should be an arbitrary restriction here.
procedure x (a : in out integer) is
function r (m : integer := a'old) return Boolean;
-- This is normally called using the entry value of a, but
-- this default can be overridden.
...
what's wrong with that? seems just fine to me!
More information about the Gcc-patches
mailing list