comp.lang.ada
 help / color / mirror / Atom feed
From: Mark.Doherty@uk.thalesgroup.com (Mark Doherty)
Subject: Re: Discriminated record question
Date: 15 May 2002 08:34:22 -0700
Date: 2002-05-15T15:34:23+00:00	[thread overview]
Message-ID: <2d87db3f.0205150734.47a94f8d@posting.google.com> (raw)
In-Reply-To: 5ee5b646.0205081856.63e2639e@posting.google.com

> 
> > Does the compiler have the freedom to raise it as a 
> > Constraint_Error?
> 
> Highly dubious if you ask me. Report it as a bug.
> 

Rational responce was ...

It's confirmed that Constraint_Error is raised due to a limit being
exceeded. Specifically, the size of an object of type B_Type (see below)
cannot be represented in (signed) 32 bits.

      type B_Type (Text_Size : Natural := 0) is
          record
              Text : String (1 .. Text_Size);
          end record;

This is covered by RM95 section 1.1.3:

   2 � Translate and correctly execute legal programs written in
       Ada, provided that they are not so large as to exceed the
       capacity of the implementation;

   3 � Identify all programs or program units that are so large as
       to exceed the capacity of the implementation (or raise an
       appropriate exception at run time);

   3.a Implementation defined:  Capacity limitations of the
       implementation.

A key term is "appropriate exception" and, clearly, the Apex compiler has
chosen to report implementation capacity overflow with a Constraint_Error.

I note that section 11.1 (6) states:

   The execution of any construct raises Storage_Error if there is
   insufficient storage for that execution.

Thus it might be argued that the RM95 is inconsistent, or should better
define "appropriate exception", although I prefer to leave such discussion
to greater minds than mine. Whatever, the Apex compiler is consistent with
the language specification and therefore correct.

...

Seems like a weak justifcation to me!



  reply	other threads:[~2002-05-15 15:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-07 12:45 Discriminated record question Grein, Christoph
2002-05-07 19:18 ` Randy Brukardt
2002-05-09  2:52   ` Robert Dewar
2002-05-09 20:29     ` Randy Brukardt
2002-05-08 10:10 ` Mark Doherty
2002-05-09  2:56   ` Robert Dewar
2002-05-15 15:34     ` Mark Doherty [this message]
2002-05-15 18:12       ` Jeffrey Carter
  -- strict thread matches above, loose matches on Subject: below --
2002-05-16  5:03 Grein, Christoph
2002-05-07 12:17 Mark Doherty
2002-05-10  9:27 ` Emmanuel Briot
replies disabled

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