Hacker News new | ask | show | jobs
by gizmo686 499 days ago
That will return 1. The defered code is executed after the return value is computed. This lets you do things like:

  char *str = foo();
  defer { free(str); }
  return strlen(str);
1 comments

https://thephd.dev/_vendor/future_cxx/technical%20specificat...

Right, there's a demonstration of GP's question (or a variation) on page 10 of the draft technical specification.