C++ conditional operator with void operand(s) -
i’m trying understand following excerpt c++ standard (iso/iec 14882:2003, newer versions same):
5.16 conditional operator
2 if either second or third operand has type (possibly cv-qualified) void, lvalue-to-rvalue (4.1), array-to-pointer (4.2), , function-to-pointer (4.3) standard conversions performed on second , third operands, ...
i inclined thinking in context, when operand function call, type of operand taken (although not) function return type. if so, yields example of void type.
i imagine throw expression surmised have type void in context, independently of type of throw operand. example.
are 2 assumptions right? there other cases?
many thanks
about throw, yes, there no result, type void , type of throw operand irrelevant. i'm not sure how relevant question seems odd.
about functions, don't know why type of operand not function return type if operand function call. else be? it's operand function (as opposed function call) function-to-pointer conversion kick in.
the result type of conditional operator depends on type of it's operands. think special language around 1 of operands being void result of conditional operator void, rules possibly performing conversions of operands of different types not relevant.
Comments
Post a Comment