Re: Very confused by Ada tasking, can not explain the execution outcome.



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
.



Relevant Pages

  • Re: Very confused by Ada tasking, can not explain the execution outcome.
    ... is never executed, but the task terminates. ... The only procedure increment ... 'rounds' is procedure 'use_res', but the procedure was never called ... during the execution. ...
    (comp.lang.ada)
  • Re: Application.Run() Application.Exit and the Message Pump
    ... it may not be appropriate to start another message pump in most real-world scenerios. ... > execution is "blocked" until you click close. ... Then finally, the application terminates. ... > Question - The closing of the first form does not 'mortally ...
    (microsoft.public.dotnet.languages.csharp)
  • Abnormal Thread Termination
    ... only once in 6000 similar execution (through same code path). ... I have observed that the thread terminates only in those ... methods where I am using IO Stream operation. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: Round up entire worksheet
    ... That means to roundup to the next increment of 1. ... Rounds up to the next increment of 10. ... for the rounded amount. ... I don't have to do this cell by cell do I? ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Asynchronous Commit in Oracle Database 10g R2
    ... >> that not every commit has caused write request to be generated. ... it should increment by 1 for the entire loop ... regardless the number of times commit is executed (execution of all the ...
    (comp.databases.oracle.server)