A screenshot of some green-highlighted proposal text, reading: EXAMPLE 5: Defer statements execute in reverse lexical order, and nested defer statements execute in reverse lexical order but at the end of the defer statement they were invoked within. The following program: int main () { int r = 0; { defer { defer { // (3) r *= 5; } // (1) r *= 3; defer { // (2) r += 1; } } defer { // (0) r += 2; } } return r; // return 35; } is equivalent to: int main () { int r = 0; r += 2; r *= 3; r += 1; r *= 5; return r; // return 35; }
https://cdn.pony.social/media_attachments/files/111/507/689/972/575/010/original/c17ba145dac9c6ee.png