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=-0.5 required=5.0 tests=BAYES_00,INVALID_MSGID, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,1ea19776e3073a96 X-Google-Attributes: gid103376,public From: "Jean-Pierre Rosen" Subject: Re: C/C++ programmer giving Ada95 a chance -- writing an emulator. Date: 2000/04/02 Message-ID: <8c7j8c$plf$1@wanadoo.fr>#1/1 X-Deja-AN: 605638855 References: <38e148e2.5089627@news.shreve.net> <38E2E979.3D1A95DE@research.canon.com.au> <38e7e951.8384503@news.shreve.net> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: abuse@wanadoo.fr X-Trace: wanadoo.fr 954683468 26287 193.250.164.16 (2 Apr 2000 13:51:08 GMT) Organization: Adalog X-MSMail-Priority: Normal NNTP-Posting-Date: 2 Apr 2000 13:51:08 GMT Newsgroups: comp.lang.ada Date: 2000-04-02T13:51:08+00:00 List-Id: jross a �crit dans le message : 38e7e951.8384503@news.shreve.net... > > I was making the assumption that a case statement would compile to > evaluate every case until finding a match -- hence, not efficient. > Several years ago, I am sure this would have been the case (no pun > intended). However, now that I think about it, a compiler these days > should be intelligent enough to create an indexed jump table where all > (or most all) consecutive values are provided and create efficient > execution code. > As a point of information, when I was working on Ada/Ed (some years ago now), I had in my office a PhD thesis on "efficient code generation techniques for case statements". There was literally a dozen of techniques possible, depending on how the values were split over the whole range... Moral: NEVER make assumptions about the way code is generated, unless you REALLY know what's happening in the compiler (which in practice means, you are part of the compiler team!) -- --------------------------------------------------------- J-P. Rosen (Rosen.Adalog@wanadoo.fr) Visit Adalog's web site at http://pro.wanadoo.fr/adalog