comp.lang.ada
 help / color / mirror / Atom feed
From: "Martin Dowie" <martin.dowie@baesystems.com>
Subject: Re: Newbie: Code isn't executed
Date: Thu, 4 Aug 2005 16:07:35 +0100
Date: 2005-08-04T15:08:19+00:00	[thread overview]
Message-ID: <42f22d52$1_1@glkas0286.greenlnk.net> (raw)
In-Reply-To: 20050804161000.1ffa591b@localhost

Thomas Ruschival wrote:
>    Total: Positive :=1000;
...
>       while Total > 0 loop
...
>          Total := Total-1;

Because Total is a Positive of range 1 .. Integer'Last, so it can never be 0
(it will raise an exception and dying silently...)

Total : Integer := 1000;

exception
   when others =>
      Put_Line ("Oops!");
end Susan;

would have stopped it being silent.

Also, sharing Total between the tasks is poor, it should be a protected
object.

And finally, what's wrong with Put_Line (instead of Put/New_Line pairs)?

Cheers

-- Martin





  parent reply	other threads:[~2005-08-04 15:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-04 14:10 Newbie: Code isn't executed Thomas Ruschival
2005-08-04 14:47 ` Ed Falis
2005-08-04 14:48 ` Egil Høvik
2005-08-04 15:07 ` Martin Dowie [this message]
2005-08-04 17:37   ` tmoran
2005-08-04 20:57     ` Randy Brukardt
2005-08-05  6:11       ` Vinzent 'Gadget' Hoefler
2005-08-06  3:52         ` tmoran
2005-08-04 20:20   ` Simon Wright
2005-08-04 15:09 ` Martin Dowie
2005-08-04 16:37 ` SOLVED: " Thomas Ruschival
2005-08-05  2:43 ` Steve
2005-08-06  5:33   ` Jeffrey Carter
replies disabled

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