From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,203d1f2317947ef5 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: others clause Date: 1996/08/31 Message-ID: #1/1 X-Deja-AN: 177719129 references: organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-08-31T00:00:00+00:00 List-Id: iChris asks 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; first of all you do not mean erroneous, please be careful with this terminology. Erroneous is a technical term in Ada with very specific meaning and it is confusing to use it in its non-tecynical sense. You mean illegal, another technical term, which should also be used only for its exact purpose.l This certainly is not illegal according to the definition in the RM, which I assume is clear (if you are asking about how to read this in the RM, then reask, it's straightforward). SO I assume this is a "why is Ada designed this way" type question? In fact I think it is highly desirable to allow a redundant others branch. Basically the others says, do this if I have not specifically taken care of it otherwise. In some cases, it may not be at all clear whether you have taken care of all branches, or may depend on constants that are configurable, and you do not want changing the configurable constant to mean that you have to go around chnaging case statements around the place. I think a compiler warning is *possibly* advisable/acceptable, but I would need to think more about this. Incidentally, in GNAT, a common usage is when others => pragma Assert (False); null; to generally note that you did not expect to get into the other section, either because all cases were covered, or because the logic says you should not be here.