Next: ick_labeledblock, Previous: ick_startup, Up: External Calls to C [Index]
A line label is something that can be NEXT
ed to and
COME FROM
. Unlike an INTERCAL line
label, it does not label a statement, and therefore attempts to
ABSTAIN
or REINSTATE
it may be errors, or may
be ignored (it’s unspecified which, which means that either may
happen for any or no reason, but exactly one will happen in any given
case, although the choice might not be consistent).
The macro ick_linelabel(expression);
may appear anywhere a
compound statement would normally be able to appear. (That is, it looks
like a function call being used as a standalone expression, but in fact
the places where it can appear are more limited.) In contrast to
ordinary line labels, an expression can be used rather than just a
constant; however, the behaviour is undefined if the expression has
side-effects. Upon encountering the line label, any COME
FROM
s or NEXT FROM
s aiming at the line label
(including ick_comefrom
s and ick_nextfrom
s)
will steal control from the program; RESUMING
after a
NEXT FROM
will work, but suffers from the same caveats as
setjmp/longjmp do (any auto variables that change their value between
the NEXT FROM
and RESUME
will have their
value clobbered (i.e. their value is no longer reliable and should not
be accessed)). Note that the INTERCAL variables are
immune to this problem. You can also avoid the problem by marking
variables as volatile
in the C program.
It is possible to NEXT
or ick_next
to a
ick_linelabel
, which has the same effect as saving the
NEXT
stack, calling the function containing the
ick_linelabel
and then immediately doing a C
goto
to an imaginary label preceding it. Due to this
possibility, an ick_linelabel
is only allowed within a
function defined with ICK_EC_FUNC_START
.
Next: ick_labeledblock, Previous: ick_startup, Up: External Calls to C [Index]