Many times when writing functions/methods I've wanted some kind of function-destructor concept. A piece of code that always runs when returning no matter where you're returning from. Of course similar effects can be done using smart pointers, additional function calls etc... but it'd be nice to have an easy-to-use buildt-in construct for this.

The basic structural idea:
Code:
int Func()
{
  first
  {
    int* x = new int(1337)

    if(Something()) return 0
    if(SomethingElse()) return 0
    if(YetSomethingElse()) return 0

    return *x
  }
  then
  {
    delete x
  }
}
The function-destructor is called after the return value has been pushed to the stack so the dereference (*x) will be safe. You won't be able to use return-statements in the destructor as it would screw things up.

Comments? Do you think this would make a useful addition?