This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: builtins: choose_expr and types_compatible_p
On 08-Dec-2001, Aldy Hernandez <aldyh@redhat.com> wrote:
> + @deftypefn {Built-in Function} @var{type} __builtin_choose_expr (@var{const_exp}, @var{exp1}, @var{exp2})
> +
> + You can use the built-in function @code{__builtin_choose_expr} to
> + evaluate code depending on the value of a constant expression. This
> + built-in function returns @var{exp1} if @var{const_exp}, which is a
> + constant expression that must be able to be determined at compile time,
> + is nonzero. Otherwise it returns 0.
> +
> + 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 was not chosen. For example, if @var{const_exp} evaluates to true,
> + @var{exp2} is not evaluated even if it has side-effects.
`?:' doesn't evaluate the expression that was not chosen either,
so in the context of "analagous ... except that", the last two sentences
there are confusing. I suggest replacing "Also" with "Like @samp{? :}".
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.