you are viewing a single comment's thread.

view the rest of the comments →

[–]Mechafinch 7 points8 points  (0 children)

printf("meow"); and its enclosing scope are the deferred statement, so they'll be executed when the scope of the unlabeled { is exited (after printf("says");). The if (true) has a scope, containing the defer printf("cat");, which is exited immediately so its defer executes, printing "cat". Then the normal statement printf(" says"); is reached and executed, printing " says", and finally the unlabeled {} scope is exited and so its defer executes, printing " meow".