comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Streams and abnormality
Date: Tue, 12 Jun 2012 10:31:17 +0100
Date: 2012-06-12T10:31:17+01:00	[thread overview]
Message-ID: <m2txygkhay.fsf@pushface.org> (raw)

Using this code with GCC 4.6, 4.7 and GNAT GPL 2011,

      Str : aliased {a child of Root_Stream_Type};
      subtype Short_Int is Integer range 0 .. 42;
      S : Short_Int;
   begin
      Integer'Output (Str'Access, -1);
      S := Short_Int'Input (Str'Access);
      Put_Line (S'Img & " " & S'Valid'Img);

I get the output " 63 FALSE".

 My reading of AARM05 13.9.1(4..6) [1] is that - because S is a scalar
 object - S should not have been allowed to become abnormal; I think
 that, instead, some exception (Constraint_Error? Data_Error?) should
 have been raised.

[1] http://www.adaic.org/resources/add_content/standards/05aarm/html/AA-13-9-1.html



             reply	other threads:[~2012-06-14 19:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12  9:31 Simon Wright [this message]
2012-06-12 15:01 ` Streams and abnormality Adam Beneschan
2012-06-12 17:03   ` Dmitry A. Kazakov
2012-06-12 17:32   ` Simon Wright
2012-06-12 18:06     ` Adam Beneschan
2012-06-12 19:49       ` Simon Wright
2012-06-21 18:29       ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox