Listing 3: Nested functions eliminate some common problems.
void func() { ubyte* ip; // byte code instruction pointer int[] stack; // operand stack int spi; // stack pointer ... int pop() { return stack[--spi]; } void push(int i) { stack[spi++] = i; } while (1) { switch (*ip++) { case ADD: op1 = pop(); op2 = pop(); push(op1 + op2); break; case SUB: ... } } }