What I'd really like to see in an if-statement...

Dieter Muller dworkin at Solbourne.COM
Mon Aug 7 07:47:58 AEST 1989


In article <14521 at bfmny0.UUCP> tneff at bfmny0.UUCP (Tom Neff) writes:
>What's wished for is a triadic comparison
>operator, which could then be used in any of the boolean contexts that
>a simple binary comparison can be used now.

I'd say what's wanted is more of an n-adic comparison operator, since
it is occassionally nice to say ``if (a < b < c < d)'', etc.  If you're
going to generalize, do it all the way.

>It would be fun to have such a thing, it would make expressing lots of
>conditions more concise and everyone would use it.  However it would
>break a lot of things in "C" (the expression above IS VALID C right now,
>for instance, with a totally different meaning) and parsing would be a
>nightmare.

Unfortunately quite correct.  Looks like another one of those ``in the
successor of C'' sorts of things (please, let's not get *that* started
again).  'Course, if someone felt ambitious, they could provide
both interpretations, selected by a #pragma.  If the construct appears
before the compiler sees one of the appropriate #pragma's, it generates
a warning and applies the "normal" interpretation.

Dieter
-- 
"Your spatial laws are ok, but God, the choices you give us." -- Deborah Blau
boulder!stan!dworkin  dworkin%stan at boulder.colorado.edu  dworkin at solbourne.com
Flamer's Hotline: (303) 678-4624 (1000 - 1800 Mountain Time)



More information about the Comp.lang.c mailing list