comp.lang.ada
 help / color / mirror / Atom feed
From: Mark.Doherty@uk.thalesgroup.com (Mark Doherty)
Subject: Constant array declarations are not causing a compilation error when not fully initialized.
Date: 23 Aug 2001 02:03:58 -0700
Date: 2001-08-23T09:03:59+00:00	[thread overview]
Message-ID: <2d87db3f.0108230103.6326861e@posting.google.com> (raw)

Why does the Ada95 LRM not gaurantee a compilation error for the
following, albeit does produce a CONTRAINT_ERROR.


procedure Test is

  type Enum is (A, B, C);

  -- the following don't produce compilation errors (just warning on
different
  -- versions of the compiler 
  Lookup_1 : constant array (Enum) of Integer := (A => 1);
  Lookup_2 : constant array (Enum) of Integer := (A => 1, B => 2);
  Lookup_3 : constant array (Enum) of Integer := (B => 1, C => 3);
  Lookup_4 : constant array (Enum) of Integer := (10, 12);

  -- the following does produce compilation error (as expected)
  Lookup_5 : constant array (Enum) of Integer := (A => 1,C => 2);

begin
    null;
end Test;

p.s. Different versions of the Rational compiler (but not all) issue a
warning that ... CONSTRAINT_ERROR will be raised...



             reply	other threads:[~2001-08-23  9:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-23  9:03 Mark Doherty [this message]
2001-08-28 23:43 ` Constant array declarations are not causing a compilation error when not fully initialized Tucker Taft
2001-08-29  2:07   ` tmoran
2001-09-04 20:50     ` Tucker Taft
replies disabled

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