Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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);


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: