C Ternary Conditional Expression Last Operand Omission

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I was reading the “C Extensions” section of GCC manual [0] about GNU
extensions, and going through the part about conditional expression
operand omission, I noticed it said it allowed the omission of the
*middle* operand (then nicely allowing some construct really similar to
the lisp or)

But I don’t understand why the analogous omission of the last operand
with the same semantics (returning the first operand if we need to
return the omitted one) is not permitted then. It’s not already standard
nor then supported by gcc, and though the same effect can be obtained by
negating the first operand, I find usually more expressive to let a
positive test expression. Also omitting the last instead of the middle
operand would have seemed more natural to write (as it maybe would have
allowed to omit the colon too, if I’m not wrong about something
conflicting with it in C syntax, as it would simplify syntax and allow
more non-simply-erroneous combinations of syntax).

Is there any justification to that? was it just considered as
unnecessary? Was this form considered less useful? was a feature
looking alike lisp or considered more evidently useful?

Should I ask on the main gcc list?

[0] (info "(gcc-6) C Extensions")
[1] (info "(gcc-6) Conditionals")




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux