Additions to C

David Korn dgk at ulysses.UUCP
Sat Jun 14 12:53:35 AEST 1986


There is one simple addition to the C language that I would like to see and
that would have been very helpful in some cases.  I would like to allow
a binary operator ?: with the following semantics:

E1 ?: E2 is equivalent to E1?E1:E2 except that E1 is not evaluated a
second time.

Note that E1 || E2 is similar but it only yields logical values.

Note that there are other operators that are like this already.
For example,

E1 += E2 is equivalent to E1 = E1 + E2 except that E1 is not evaluated
a second time.

I don't object to ?: being :?  (=+ became +=) but I think that this
change would be useful.

David Korn
ulysses!dgk



More information about the Comp.lang.c mailing list