* Richard Kenner:

>     > Well sure, reading an uninitialized value is erroneous except for the 
> use
>     > of 'Valid.
>
>     No, it's not, as Ada is not C.  
>
> What's "not"?  My statement is based on the Ada RM.

Quote from section 13.9.1 follows.  Note the "but does not by itself
lead to erroneous or unpredictable execution" part.

                         Bounded (Run-Time) Errors

  9. If the representation of a scalar object does not represent a
     value of the object's subtype (perhaps because the object was not
     initialized), the object is said to have an invalid
     representation. It is a bounded error to evaluate the value of
     such an object. If the error is detected, either Constraint_Error
     or Program_Error is raised. Otherwise, execution continues using
     the invalid representation. The rules of the language outside this
     subclause assume that all objects have valid representations. The
     semantics of operations on invalid representations are as follows:

      10. If the representation of the object represents a value of the
          object's type, the value of the type is used.

      11. If the representation of the object does not represent a
          value of the object's type, the semantics of operations on
          such representations is implementation-defined, but does not
          by itself lead to erroneous or unpredictable execution, or to
          other objects becoming abnormal.

>     And please note the presence of pragma Normalize_Scalars.
>
> That doesn't affect validity or erroneousness.

It affects predictability.  As Robert wrote, the test case must print
SUCCESS.

Reply via email to