C conditional operator ('?') with empty second parameter

c, conditional-statements, operators, ternary-operator

Solution

It is not permitted by the language C (as far as I know), but compilers such as gcc have the shortcut a?:c as an extension. `a?:c` means the same as `a?a:c`.

Problem

Typically the '?' operator is used in the following form: ``` A ? B : C ``` However in cases where B = A I have seen the following abbreviation ``` A ? : C ``` This surprisingly works. Is it better to leave the second parameter in (style wise), or is their a chance certain compilers won't be able to handle this?

Original source

Related problems