comp.lang.ada
 help / color / mirror / Atom feed
From: climber.cui@gmail.com
Subject: Re: Very confused by Ada tasking, can not explain the execution outcome.
Date: Sat, 30 Aug 2008 02:42:51 -0700 (PDT)
Date: 2008-08-30T02:42:51-07:00	[thread overview]
Message-ID: <bc6367fc-831c-4e83-824b-e93dff1c2907@b1g2000hsg.googlegroups.com> (raw)
In-Reply-To: vF4uk.319979$yE1.172720@attbi_s21

On Aug 30, 1:12 am, "Jeffrey R. Carter"
<spam.jrcarter....@spam.acm.org> wrote:
> climber....@gmail.com wrote:
> >   - the last sentence of the task body, which is a put_line statement
> > is never executed, but the task terminates.
> >  - also, the per task counter 'rounds', was never incremented, it
> > stays the same as the initial value. The only procedure increment
> > 'rounds' is procedure 'use_res', but the procedure was never called
> > during the execution.  If you notice the entry condition for the while
> > loop, 'while rounds<2 loop', how could it get out of the loop if
> > 'rounds' was never incremented??  why the program still terminates??
>
> If an exception occurs in your task, the task will terminate silently. This is a
> way your task and program could terminate although it never increments Rounds
> nor executes its final statement.
>
> --
> Jeff Carter
> "If I could find a sheriff who so offends the citizens of Rock
> Ridge that his very appearance would drive them out of town ...
> but where would I find such a man? Why am I asking you?"
> Blazing Saddles
> 37
.
Thanks Jeff. It seems you are right.  Some exceptions occurs during
the task execution, and Ada is ignoring it. It is very likely to the
'array index out of bound'.  I doubt that Ada follows the strict
evaluation rules when it evaluates the boolean expressions, that is it
will evaluate every term(connected by logical operators),  like in:
  if  D<N and Needs(D)  then..
  Ada would evaluate both D<N and Needs(D). This could cause problem
sometimes if strict-evaluation rules are followed. Many languages
follows the non-strict evaluation rules, so if D<N is false, it will
not bother to evaluate Needs(D).

tony



  reply	other threads:[~2008-08-30  9:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-30  1:54 Very confused by Ada tasking, can not explain the execution outcome climber.cui
2008-08-30  4:17 ` jimmaureenrogers
2008-08-30  9:34   ` climber.cui
2008-08-30 10:59     ` Damien Carbonne
2008-08-31 13:37       ` Stephen Leake
2008-08-30  5:12 ` Jeffrey R. Carter
2008-08-30  9:42   ` climber.cui [this message]
2008-08-30 13:40     ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox