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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,971aa11c293c3db1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-23 01:23:24 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!opentransit.net!proxad.net!nerim.net!norfair.nerim.net!not-for-mail From: "Bertrand Augereau" Newsgroups: comp.lang.ada Subject: Re: Ada The Best Language? Date: Mon, 23 Jul 2001 10:27:27 +0200 Organization: Nerim -- xDSL Internet Provider Message-ID: <9jgmtp$3a1$1@norfair.nerim.net> References: <5be89e2f.0107170838.c71ad61@posting.google.com> <5be89e2f.0107180235.726d46a8@posting.google.com> <9j3rrd$g71$1@s1.read.news.oleane.net> <5be89e2f.0107181300.4b4e93d7@posting.google.com> <3B57195E.A3A3FED@home.com> <9j93u6$1ua8$1@norfair.nerim.net> <3B586A17.862BA84D@home.com> <9j9s3t$kn8$1@wanadoo.fr> <9jej7c$7q1$1@wanadoo.fr> <9jff9l$sqp$1@wanadoo.fr> <3b5bd4b2.1217171@news.cis.dfn.de> NNTP-Posting-Host: aboukir-101-2-1-inutero.adsl.nerim.net X-Trace: norfair.nerim.net 995876601 3393 62.4.19.69 (23 Jul 2001 08:23:21 GMT) X-Complaints-To: abuse@nerim.net NNTP-Posting-Date: Mon, 23 Jul 2001 08:23:21 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:10448 Date: 2001-07-23T10:27:27+02:00 List-Id: > > enum COLOR { BLUE, RED, GREEN }; > > int main (void) > { > COLOR X = BLUE; > > switch (X) > { > case 0 : break; > } > return 0; > } > I don't see this type of code as a coding mistake, it is just a nonsense way of doing it. This can only be an intentional mistake and type safety is there mainly for protecting you against non-intentional mistakes. That's what forbidding implicit int->enum is for. I'm not sure a compiler has to take care of this error, though Ada programmers might think otherwise. It is often nice to have a enum->int conversion, especially when you can map your enum to some int you need. enum BOOL { FALSE = 0, TRUE = !0; }; Then if you need a enum->int mapping, you just have it for free by the fact enum are reprensented by int in the machine (as with Ada, I suppose). I think you can do that in Ada if you need it with using clause.