This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING^2] ada: Add limitations on the acceptable prefixes of 'Old


On  7/05, Robert Dewar wrote:

> 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!

Yes, the updated patch I'm testing right now forbids using 'Old in this
context only if "r" is not enclosed within another subprogram. And this
doesn't require changing the doc :)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]