What I'd really like to see in an if-statement...
John Hascall
hascall at atanasoff.cs.iastate.edu
Mon Aug 7 01:14:00 AEST 1989
In article <5027> spl at mcnc.org.UUCP (Steve Lamont) writes:
}In article <1300> hascall at atanasoff.cs.iastate.edu.UUCP (John Hascall) writes:
}@In article <5024> spl at mcnc.org.UUCP (Steve Lamont) writes:
}@} if ( foo < bar < baz ) ...
}@} Good idea or bad idea?
}@
}@ It's in COBOL (along with everything else).
}@ To answer your other question, COBOL is a bad idea.
}That really doesn't address the question: is the mathematical inequality test
}shown in my example a *bad* idea?
Sorry, I should have followed that last bit with a smiley :-)
I can see no reason why it is a bad idea (from a programming standpoint).
And I can come up with a reason why it is a good idea (side effects):
while (min < *ptr++ < max) ...
I can see no way to do this sort of thing as cleanly with ``< && <''.
I compiler writer might have other opinions though!
John
More information about the Comp.lang.c
mailing list