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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fcf8ea94b94d6941 X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: Modular type. What is it and why? Date: 1999/04/06 Message-ID: <370A4B3A.5EDB3B37@pwfl.com>#1/1 X-Deja-AN: 463320267 Content-Transfer-Encoding: 7bit Sender: condicma@bogon.pwfl.com References: <7ean3c$79m$1@eol.dd.chalmers.se> <7eb2iq$jc3@hobbes.crc.com> <7ede2p$pd1$1@its.hooked.net> Content-Type: text/plain; charset=us-ascii Organization: Pratt & Whitney Mime-Version: 1.0 Reply-To: diespammer@pwfl.com Newsgroups: comp.lang.ada Date: 1999-04-06T00:00:00+00:00 List-Id: Mike Silva wrote: > Now with Ada I'll be able to write (assuming 'index' is the appropriate > modular type): > > case ( key ) is > when ARROW_DOWN => > index := index + 1; > when ARROW_UP => > index := index - 1; > end case; > > Now -that's- what I call progress! > My C is pretty rusty - not having done anything serious in it in at least 10 years - but wasn't there some kind of type/operation that allowed for wraparound semantics? I know one of the major early bitches about Ada(83) was that it didn't allow for unsigned integers, logical ops on integers & wraparound math - all things considered critical for embedded programming. (At least at that point in time) If C doesn't support some or all of these things, then how could it be so "popular" with the embedded crowd? I remember enough C to recall that you did have logical operations on integers and shift/rotate operations on integers as well. Maybe (if my Parts-heimers would clear up a little so I could remember) the wraparound semantics were always implemented using logical ops? Not nearly as pretty as The Ada Way, but it would get you there... MDC -- Marin David Condic Real Time & Embedded Systems, Propulsion Systems Analysis United Technologies, Pratt & Whitney, Large Military Engines M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600 ***To reply, remove "bogon" from the domain name.***