SuperC documentation

Defer

Will execute the code stated right before exiting a function.

Examples

Assembly code generation

Defer in SuperC is not a function call, or a rewriting the code before each return, it is simpler and clever than that.

Below is a pseudo assembly example of how the SuperC compiler emits defer statements.

Can you guess what x will be at the end of the program?
a. 10
b. 99
c. 20
d. stack garbage


Previous

Getting started

Next

(DRAFT) Defer auto