Re: Very confused by Ada tasking, can not explain the execution outcome.
- From: climber.cui@xxxxxxxxx
- Date: Sat, 30 Aug 2008 02:42:51 -0700 (PDT)
On Aug 30, 1:12 am, "Jeffrey R. Carter"
<spam.jrcarter....@xxxxxxxxxxxx> wrote:
climber....@xxxxxxxxx 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
.
- Follow-Ups:
- Re: Very confused by Ada tasking, can not explain the execution outcome.
- From: Georg Bauhaus
- Re: Very confused by Ada tasking, can not explain the execution outcome.
- References:
- Very confused by Ada tasking, can not explain the execution outcome.
- From: climber . cui
- Re: Very confused by Ada tasking, can not explain the execution outcome.
- From: Jeffrey R. Carter
- Very confused by Ada tasking, can not explain the execution outcome.
- Prev by Date: Re: Very confused by Ada tasking, can not explain the execution outcome.
- Next by Date: Re: Very confused by Ada tasking, can not explain the execution outcome.
- Previous by thread: Re: Very confused by Ada tasking, can not explain the execution outcome.
- Next by thread: Re: Very confused by Ada tasking, can not explain the execution outcome.
- Index(es):
Relevant Pages
|