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: f849b,b8d52151b7b306d2 X-Google-Attributes: gidf849b,public X-Google-Thread: 103376,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-27 07:25:05 PST Message-ID: <3feda44e_3@mk-nntp-1.news.uk.worldonline.com> From: Ian Bell Subject: Re: Certified C compilers for safety-critical embedded systems Newsgroups: comp.arch.embedded,comp.lang.ada Followup-To: comp.arch.embedded Date: Sat, 27 Dec 2003 15:27:53 +0000 References: <3fe00b82.90228601@News.CIS.DFN.DE> <3FE026A8.3CD6A3A@yahoo.com> <$km9afA3DB7$EAYO@phaedsys.demon.co.uk> Organization: REMAP User-Agent: KNode/0.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit NNTP-Posting-Host: ppp-225-3-100.friaco.access.uk.tiscali.com X-Trace: 27 Dec 2003 15:25:03 GMT, ppp-225-3-100.friaco.access.uk.tiscali.com Path: archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed.vmunix.org!kibo.news.demon.net!demon!mk-nntp-1.news.uk.worldonline.com!ppp-225-3-100.friaco.access.uk.tiscali.com Xref: archiver1.google.com comp.arch.embedded:6151 comp.lang.ada:3847 Date: 2003-12-27T15:27:53+00:00 List-Id: James Rogers wrote: snip > > type my_index is range 0..9; > type My_Array_Type is array(my_index) of integer; > > foo : My_Array_Type; > > for num in 0..99 loop > foo(num) := num; > end loop; > > All Ada compilers will correctly identify the error in the for loop. > The type of "num" is not the same as the type of the index, because > the range of values defined for "num" are not all within the range of > values in my_index. This detection will happen properly no matter how > far the definition is separated from the "for" loop. > I know nothing about ada so this is a genuine query rather than a ctiticism. The above example is fine as long as literals are used - even a C compiler could be devised to make this check - but what happens when the array index is computed? Ian