Next: , Previous: , Up: External Calls to C   [Index]


14.1.8 ick_forget

The ick_forget macro removes NEXT stack entries, and the corresponding C stack entries. It must be called as a statement by itself, and its invocation looks like this: ick_forget(expr);, where the expression is the number of NEXT stack entries to forget (all of them will be forgotten if the number is higher than the number of entries). The expression will be casted to an unsigned short.

ick_forget can only be used inside a function declared with ICK_EC_FUNC_START. As it is removing stack entries both in INTERCAL and in C, it will clobber the value of all auto variables created since the highest remaining NEXT stack entry came into being (or since the start of the program, if the NEXT stack is emptied by the command) and also deallocate all alloca storage allocated since then. It also causes the return address of the current function to become undefined, so that function must not return; control may leave it via RESUME, or via COME FROM, or via NEXT or NEXT FROM followed by the relevant NEXT stack entry being forgotten (the function is still ’running’ but suspended while the NEXT stack entry still exists). (Note that these restrictions are stronger than those on RESUME; this is because RESUME preserves most of the stack, but FORGET destroys parts of the stack and therefore cannot avoid destroying the data stored there. It could be much worse; a previous (never released) version of the code didn’t remove those parts of the stack in many circumstances, leading to a stack leak that caused programs to segfault after a while.)


Next: , Previous: , Up: External Calls to C   [Index]