8 Feb 2012 redi   » (Master)

fzort and cdfrey, the conditional (a.k.a ternary) operator doesn't strictly require the second and third operands to have the same type, but it must be possible to convert one operand to the type of the other. In fzort's example both needed to be converted to foo*, neither can be converted to the other type, so it's ill-formed.

(There is another form allowed which doesn't require conversion, where one of the operands is a throw-expression: which ? new foo : throw "catch me". This isn't entirely useless syntactic sugar, it can be used to throw exceptions from constexpr functions, which don't allow if statements.)

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!