Hello, > > what exactly is the semantics of the cleanup for TARGET_EXPR? > > Documentation says: > > > > > >>Often, a @code{TARGET_EXPR} occurs on the right-hand side of an > >>assignment, or as the second operand to a comma-expression which is > >>itself the right-hand side of an assignment, etc. In this case, we say > >>that the @code{TARGET_EXPR} is ``normal''; otherwise, we say it is > >>``orphaned''. > > > > ... > > > >>If this expression is orphaned, then this expression must be executed > >>when the statement containing this expression is complete. > > > > > > What does "etc." in the definition of ``normal'' mean? Is say target_expr > > in > > > > a = b ? TARGET_EXPR : something; > > > > orphaned? If TARGET_EXPR is not orphaned, is it allowed to run its cleanup? > > That should be considered a "normal" use, just like "a = TARGET_EXPR". > > In the abstract, the best thing might be for there to be a TARGET_EXPR > around the entire COND_EXPR, but IIRC, the way it works is that there > will be a TARGET_EXPR for each arm of the conditional. Here, the > cleanups should not be run. However, if it were just "b ? TARGET_EXPR : > something", then the cleanups should be run; that would be an orphaned use.
umm... OK. Could you please provide an example (that could perhaps also be added to documentation) of how TARGET_EXPRs are used, that would explain the rationale behind this semantics? Zdenek