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



climber.cui@xxxxxxxxx wrote:
On Aug 30, 1:12 am, "Jeffrey R. Carter"

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.

Thanks Jeff. It seems you are right. Some exceptions occurs during
the task execution, and Ada is ignoring it.

Ada is not actually ignoring exceptions in tasks; the program
is following the Ada rules: Add these lines,

Put_Line("TASK EXITS :: rounds =" & INTEGER'Image(rounds) &
"...." );

exception
when X: others =>
Put_Line("TASK failed due to " &
Ada.Exceptions.Exception_Information(X));
end User_thread;

and you should see something like
TASK failed due to Exception name: CONSTRAINT_ERROR
Message: multi_res_alloc_a.adb:131 index check failed

So, yes,
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,

you would specify short circuit evaluation using "and then"
etc. as explained by Damien Carbonne; Ada follows the rules
defined in the LRM, section

"4.5.1 Logical Operators and Short-circuit Control Forms"

.



Relevant Pages

  • Re: [announcement] SYSAPI and SYSSVC for Windows
    ... What do you need Windows NT for in this application? ... You can use SEH (Structured Exception Handling) to prevent a process from ... > Ada did solve this, ... If you implement your own message queues on Windows, use an Event object ...
    (comp.lang.ada)
  • Re: Error-names.
    ... an exception you never thought about when designing the component. ... >> If you are writing a bridge that is controlled by C executable accessing an ada ... All exceptions are passed to the calling ... The advantage of this programming lifestyle which I learned from OLE(windows ...
    (comp.lang.ada)
  • Re: In-Out Parameters for functions
    ... > the Ada mindset) was that the reason for l-d checks is to prevent the ... sense given the way today's CPUs are built. ... to avoid erroneousness in some contexts. ... -- object declarations here should never raise an exception. ...
    (comp.lang.ada)
  • Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... > can store your string inside the database you have to make a sanity check. ... > In Ada I could use Ada.Strings.Bounded_Strings instead. ... > The other example is CORBA. ... >>Ada's exception handling is also primitive at best (exceptionally so, ...
    (comp.lang.ada)
  • Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... A preprocessor per so, no. ... but are almost entirely missing from Ada. ... > compiler is called. ... > occured' style exception. ...
    (comp.lang.ada)