summaryrefslogtreecommitdiff
path: root/gcc/doc/c-tree.texi
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-18 03:29:17 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-18 03:29:17 +0000
commit35074dd1f357610f820645a8357eae82bf6492c6 (patch)
tree420b0c2abedc67d6776f1361fd25518eaead0a39 /gcc/doc/c-tree.texi
parent41571cdea25006e87a7560bcf8d9435123641613 (diff)
downloadgcc-35074dd1f357610f820645a8357eae82bf6492c6.tar.gz
* doc/c-tree.texi: Update description of COND_EXPR tree nodes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58268 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc/c-tree.texi')
-rw-r--r--gcc/doc/c-tree.texi34
1 files changed, 15 insertions, 19 deletions
diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi
index 9ca94806c40..0b9f4d69d75 100644
--- a/gcc/doc/c-tree.texi
+++ b/gcc/doc/c-tree.texi
@@ -2127,25 +2127,21 @@ These nodes represent @code{?:} expressions. The first operand
is of boolean or integral type. If it evaluates to a nonzero value,
the second operand should be evaluated, and returned as the value of the
expression. Otherwise, the third operand is evaluated, and returned as
-the value of the expression. As a GNU extension, the middle operand of
-the @code{?:} operator may be omitted in the source, like this:
-
-@example
-x ? : 3
-@end example
-@noindent
-which is equivalent to
-
-@example
-x ? x : 3
-@end example
-
-@noindent
-assuming that @code{x} is an expression without side-effects. However,
-in the case that the first operation causes side effects, the
-side-effects occur only once. Consumers of the internal representation
-do not need to worry about this oddity; the second operand will be
-always be present in the internal representation.
+the value of the expression.
+
+The second operand must have the same type as the entire expression,
+unless it unconditionally throws an exception or calls a noreturn
+function, in which case it should have void type. The same constraints
+apply to the third operand. This allows array bounds checks to be
+represented conveniently as @code{(i >= 0 && i < 10) ? i : abort()}.
+
+As a GNU extension, the C language front-ends allow the second
+operand of the @code{?:} operator may be omitted in the source.
+For example, @code{x ? : 3} is equivalent to @code{x ? x : 3},
+assuming that @code{x} is an expression without side-effects.
+In the tree representation, however, the second operand is always
+present, possibly protected by @code{SAVE_EXPR} if the first
+argument does cause side-effects.
@item CALL_EXPR
These nodes are used to represent calls to functions, including