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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ebc5bf96039d7210 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!cleanfeed4-a.proxad.net!nnrp11-1.free.fr!not-for-mail Date: Sat, 30 Aug 2008 12:59:04 +0200 From: Damien Carbonne User-Agent: Thunderbird 2.0.0.16 (X11/20080707) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Very confused by Ada tasking, can not explain the execution outcome. References: <023de8e6-ce28-4a97-8103-ff855289a795@b30g2000prf.googlegroups.com> <898a5f1d-75f7-4f66-a241-440e9c225454@z66g2000hsc.googlegroups.com> In-Reply-To: <898a5f1d-75f7-4f66-a241-440e9c225454@z66g2000hsc.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <48b927f8$0$17330$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 30 Aug 2008 12:59:04 MEST NNTP-Posting-Host: 82.247.219.63 X-Trace: 1220093944 news-3.free.fr 17330 82.247.219.63:47627 X-Complaints-To: abuse@proxad.net Xref: g2news1.google.com comp.lang.ada:1838 Date: 2008-08-30T12:59:04+02:00 List-Id: climber.cui@gmail.com a �crit : > Thank you Jim for modifying the program and making it work. I saw how > you modify the guarding conditions for the procedures. In fact, the > conditions are fine by themselves, because i wrote the same program in > Java. However, the modified program is working now. It indeed reminds > me that Ada probably follows the 'strict evaluation' rule when it > comes to the boolean expressions, so in > if Next=1 and State=0 and D Ada probably would evaluate all the predicates connect by logical > AND, but as soon as D=N is reached, array index for Needs(_) would go > out of bound (because Needs is defined to be array(0..N-1) of > boolean). I am just guessing here. Use "and then" instead of "and" to obtain what Java does with "and" : --> if Next=1 and then State=0 and then D > This would not cause exceptions in Java, because java follows the non- > strict evaluation rule. > > tony