Upon each transfer of control (including sequential execution of statements)
within a function from point
P to point
Q,
all block variables with automatic storage duration
that are active at
P and not at
Q are destroyed in the reverse order of their construction
. Then, all block variables with automatic storage duration
that are active at
Q but not at
P are initialized in declaration order;
unless all such variables have vacuous initialization (
[basic.life]),
the transfer of control shall not be a jump
.
When a
declaration-statement is executed,
P and
Q are the points immediately before and after it;
when a function returns,
Q is after its body
. [
Example 1:
void f() {
goto lx;
ly:
X a = 1;
lx:
goto ly;
}
—
end example]