comp.lang.ada
 help / color / mirror / Atom feed
From: Chris Sparks <sparks@AISF.COM>
Subject: others clause
Date: 1996/08/29
Date: 1996-08-29T00:00:00+00:00	[thread overview]
Message-ID: <INFO-ADA%96082914113458@LISTSERV.NODAK.EDU> (raw)


Why is the following not incorrect?

---------------------------------------------------------------------
procedure T is

  type Enum is (A, B, C, D, E, F);

  T1 : Enum    := Enum'First;
  T2 : Integer := 0;

begin
  case T1 is
    when A      => null;
    when B      => null;
    when C      => null;
    when D      => null;
    when E      => null;
    when F      => null;
    when others => null;               --WHY ISN'T THIS ERRONEOUS?
  end case;

  case T2 is
    when Integer'First .. -1 => null;
    when 0                   => null;
    when 1 .. Integer'Last   => null;
    when others              => null;  --WHY ISN'T THIS ERRONEOUS?
  end case;

end T;
---------------------------------------------------------------------
It seems to me that if we have identified all of the possible values,
then other would be invalid.  You can't test for others in the above
two cases!

Any feedback would be appreciated.

Chris Sparks (aka Mr. Ada)
sparks@aisf.com




             reply	other threads:[~1996-08-29  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-29  0:00 Chris Sparks [this message]
1996-08-30  0:00 ` others clause Mike Bishop
1996-08-31  0:00   ` Robert A Duff
1996-09-02  0:00   ` Geert Bosch
1996-09-03  0:00     ` Robert Dewar
1996-09-02  0:00   ` Brian Rogoff
1996-09-03  0:00   ` Adam Beneschan
1996-08-31  0:00 ` Robert Dewar
1996-09-02  0:00 ` Stephen Bull
replies disabled

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