On 19.06.2024 16:01, Jan Beulich wrote:
> Present wording has misled people to believe the ?: operator would be
> evaluating all three of the involved expressions.
>
> gcc/
>
> * doc/extend.texi: Clarify __builtin_choose_expr() similarity to
> the ?: operator.
Anyone? I don't think I can simply commit this as "trivial" - there's a
certain chance that I'm actually wrong here, after all.
Thanks, Jan
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -14962,9 +14962,9 @@ struct {
>
> This built-in function is analogous to the @samp{? :} operator in C,
> except that the expression returned has its type unaltered by promotion
> -rules. Also, the built-in function does not evaluate the expression
> -that is not chosen. For example, if @var{const_exp} evaluates to
> @code{true},
> -@var{exp2} is not evaluated even if it has side effects.
> +rules. Like the @samp{? :} operator, the built-in function does not evaluate
> +the expression that is not chosen. For example, if @var{const_exp} evaluates
> +to @code{true}, @var{exp2} is not evaluated even if it has side effects.
>
> This built-in function can return an lvalue if the chosen argument is an
> lvalue.