comp.lang.ada
 help / color / mirror / Atom feed
From: "Ant" <ant@work.invalid>
Subject: Re: Test for > 'last
Date: Fri, 14 Mar 2003 17:22:59 -0000
Date: 2003-03-14T17:22:59+00:00	[thread overview]
Message-ID: <3e721008$0$895$9b0f33e3@clyde> (raw)
In-Reply-To: 1b585154.0303140406.124c3312@posting.google.com

"Peter Richtmyer" <prichtmyer@yahoo.com> wrote in message
news:1b585154.0303140406.124c3312@posting.google.com...
> This may be trivial, but I have come across some code
> in a (weapon control) system that does checks similar
> to:
>
>     ---------------------------------------
>     if enum_input < enum_type'first or
>        enum_input > enum_type'last then
>        -- handle the input error
>     ---------------------------------------

[...]

> But I am wondering whether people think the original code
> is OK, sort of wrong, really grossly wrong, or what.

I would rather do this:

if enum_input not in enum_type'first .. enum_type'last then
  -- handle error
end if;





  parent reply	other threads:[~2003-03-14 17:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-14 12:06 Test for > 'last Peter Richtmyer
2003-03-14 12:24 ` Jeffrey Creem
2003-03-14 17:22 ` Ant [this message]
2003-03-14 18:10   ` Vinzent Hoefler
2003-03-17 11:28     ` Ant
2003-03-15  2:02 ` 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