comp.lang.ada
 help / color / mirror / Atom feed
* Alternative for AQS-95 para. 5.6.6
@ 1996-04-04  0:00 W. Wesley Groleau (Wes)
  0 siblings, 0 replies; only message in thread
From: W. Wesley Groleau (Wes) @ 1996-04-04  0:00 UTC (permalink / raw)


Ada 95 Quality and Style carries forward the AQS-83 recommendation for
a safety check to prevent runaway looping or recursion.  The suggestion
is based on a counter and a limit check.  For real-time or safety critical
systems, a time limit may be more useful than a count.  Is there any
detail I've missed that would prevent using the following technique?

select
  delay Message_Interval * 0.75;
  raise Processing_Took_Too_Long;
then abort
  loop          |or| Recursive_Subprogram;
  end loop;     |  |
end select;

For Ada 83, please critique this:

Runaway.Start_Checking
             ( Check_ID   => Local_Check,  -- initializes ID which
<EITHER>       Time_Limit => <duration> ); -- contains discriminant
  <OR>         Iter_Limit => <count>    ); -- set by choice of start

[ while xxx | for xxx ] loop

   Runaway.Check ( Local_Check );
   -- raises Too_Much_Time or Too_Many_Times

Actual package Runaway is trivial to implement (and these are not my
original names).  But I'm not sure it's worth the time.  I had already
done the spec, but the file seems to have Run Away  :-)

The above is not any easier than the AQS approach, but it does have the
advantage of standardizing the technique for a whole project.

I know I can count on c.l.a for plenty of useful feedback (and probably
a flame or two).

--
---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Magnavox - Mail Stop 10-40                               Home: 219-471-7206
Fort Wayne,  IN   46808              elm (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-04-04  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-04  0:00 Alternative for AQS-95 para. 5.6.6 W. Wesley Groleau (Wes)

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