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,751584f55705ddb7 X-Google-Attributes: gid103376,public From: Alan Brain Subject: Re: Ada is almost useless in embedded systems Date: 1996/03/18 Message-ID: <4iif6g$o5o@fred.netinfo.com.au>#1/1 X-Deja-AN: 143239027 references: <823906039.22113@assen.demon.co.uk> <4hv2fb$6ra@cville-srv.wam.umd.edu> content-type: text/plain; charset=us-ascii organization: Netinfo Pty Ltd - Canberra Australia mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 1.2N (Windows; I; 16bit) Date: 1996-03-18T00:00:00+00:00 List-Id: eachus@spectre.mitre.org (Robert I. Eachus) wrote: > No, but the differnce is cultural, not linguistic. There have been >programs where I needed to do lots of incrementing and declared: > > procedure Inc(X: in out Integer; Y: in Integer := 1) > is begin X := X + Y; end Inc; > pragma Inline(Inc); > > ...and then went and used it all over. I even had one program that >provided half a dozen similar operations, and instantiated it for >several integer types. Ditto here - mainly using generics. This also gives you the opportunity of defining exactly what exception you want raised if you accidentally overstray the bounds of the input type. Hands up all those who have never done i++ and had the result go over the intended maximum value of i? Ada won't stop you doing this (ie committing a bug) - but will tell you about it at run-time, and allow you to write code that will work regardless.