What I'd really like to see in an if-statement...
Steve Lamont
spl at mcnc.org
Sun Aug 6 01:02:43 AEST 1989
All this discussion about arithmetic ifs has goaded me into posting my own
particular pet construct.
Since I do a lot of programming that involves mathematical expressions of one
sort of another I often find myself wishing for an if construct that looks
like
if ( foo < bar < baz )
do_something();
else
do_something_else();
which is, of course, equivalent to
if ( ( foo < bar ) && ( bar < baz ) )
do_something();
else
do_something_else();
Is there any reason why such a construction is not practical? If not, why has
no language (that I am aware of or can program in) implemented such a
construction? Good idea or bad idea?
--
spl
Steve Lamont, sciViGuy EMail: spl at ncsc.org
North Carolina Supercomputing Center Phone: (919) 248-1120
Box 12732/RTP, NC 27709
More information about the Comp.lang.c
mailing list