GCC/Clang have an extension _cleanup_<foo>_ which allows function <foo> to be called on a variable when you leave scope. This is really handy for marking pointers such that their memory is guaranteed to be freed, eg.:
| #define _cleanup_free_ __attribute__((cleanup(freep)))
static inline void freep(void *p) { free(*(void **)p); }
|
Is there an analagous feature in MSVC?