What I'd really like to see in an i

mcdonald at uxe.cso.uiuc.edu mcdonald at uxe.cso.uiuc.edu
Mon Aug 7 23:25:00 AEST 1989



It would seem that the expression a < b < c is legal C, and might
be a useful construct (especially in the Obfuscated C Contest...).
In fact, it is actually mentioned as legal in K&R I, on page 189.
Of course, they say it "does not mean what it seems to". It also
says relational operators group left-to-right, so it is

(a < b ) < c  .

This tests for c less than 1 or 0 depending on whether  a < b or not.


Doug McDonald



More information about the Comp.lang.c mailing list