This documentation error exists for all versions of gcc-3.*, gcc-4.* documentation. Relevant links are http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Other-Builtins.html http://gcc.gnu.org/onlinedocs/gcc-4.0.3/gcc/Other-Builtins.html The error text is: Built-in Function: type __builtin_choose_expr (const_exp, exp1, exp2) You can use the built-in function __builtin_choose_expr to evaluate code depending on the value of a constant expression. This built-in function returns exp1 if const_exp, which is a constant expression that must be able to be determined at compile time, is nonzero. --> Otherwise it returns 0. should be --> Otherwise it returns exp2. This is confusing and misleading for the actual functionailty of the builtin, it shold be changed.
Confirmed. This has been an issue since the function was added.
*** Bug 33013 has been marked as a duplicate of this bug. ***
Is there any reason why this hasn't been fixed yet? (The trunk still has the error. And I'm asking this because there's only one word to change.)
I'm also curious why the trivial fix has not been applied yet. --- a/gcc-4.5.1/gcc/doc/extend.texi 2010-11-29 18:39:21.000000000 +0100 +++ b/gcc-4.5.1/gcc/doc/extend.texi 2010-11-29 18:39:54.000000000 +0100 @@ -7026,7 +7026,7 @@ 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 an -integer constant expression, is nonzero. Otherwise it returns 0. +integer constant expression, is nonzero. Otherwise it returns @var{exp2}. This built-in function is analogous to the @samp{? :} operator in C, except that the expression returned has its type unaltered by promotion
This was fixed in r163675.