From: prichtmyer@yahoo.com (Peter Richtmyer)
Subject: Test for > 'last
Date: 14 Mar 2003 04:06:34 -0800
Date: 2003-03-14T12:06:35+00:00 [thread overview]
Message-ID: <1b585154.0303140406.124c3312@posting.google.com> (raw)
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
---------------------------------------
I have experimented, and found that this type of code
could do at least 3 different things, depending upon
the compiler and error-checking options:
- always say that "enum_input" is OK, regardless of its "validity"
- always raise an exception when the data is invalid
- work as intended
I think they were running the code with no exceptions
being raised.
I also think the code should be using the 'valid test instead.
But I am wondering whether people think the original code
is OK, sort of wrong, really grossly wrong, or what.
thanks,
Peter
next reply other threads:[~2003-03-14 12:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-14 12:06 Peter Richtmyer [this message]
2003-03-14 12:24 ` Test for > 'last 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox