Call/Return feature of classic C++(C with Classes), what modern languages have it?

依然范特西╮ 提交于 2019-12-05 02:29:59

The modern C++ equivalent would be a sentry object: construct it at the beginning of a function, with its constructor implementing call(), and upon return (or abnormal exit), its destructor implements return().

Aspect Oriented Programming has this. http://en.wikipedia.org/wiki/Aspect-oriented_programming

Aspect Oriented Programming (also known as AOP) has the ability to create interceptors before, after and around code.

The D2 programming language has this and more with it's ScopeGuards. It's designed so you can use multiple ones, they work like a FILO stack.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!