comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Test for > 'last
Date: Sat, 15 Mar 2003 02:02:56 GMT
Date: 2003-03-15T02:02:56+00:00	[thread overview]
Message-ID: <3E728A25.8020701@acm.org> (raw)
In-Reply-To: 1b585154.0303140406.124c3312@posting.google.com

Peter Richtmyer wrote:
> 
>     ---------------------------------------
>     if enum_input < enum_type'first or 
>        enum_input > enum_type'last then 
>        -- handle the input error
>     ---------------------------------------

Without knowing the type of Enum_Input, it's impossible to tell. This is 
simply an awkward way to say

if Enum_Input not in Enum_Type then

So it appears the coder did not have a lot of Ada experience and 
probably didn't understand what he was doing.

If Enum_Input is of type Enum_Type, then the compiler probably optimized 
the condition to False and reduced the statement to the else part; if 
there's no else part, then it would optimize the entire if away.

-- 
Jeff Carter
"That was the most fun I've ever had without laughing."
Annie Hall




      parent reply	other threads:[~2003-03-15  2:02 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
2003-03-14 18:10   ` Vinzent Hoefler
2003-03-17 11:28     ` Ant
2003-03-15  2:02 ` Jeffrey Carter [this message]
replies disabled

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