Skip to content

Instantly share code, notes, and snippets.

@Mikoangelo
Forked from simonask/gist:114710
Created May 20, 2009 09:14
Show Gist options
  • Save Mikoangelo/114715 to your computer and use it in GitHub Desktop.
Save Mikoangelo/114715 to your computer and use it in GitHub Desktop.
#include <stdio.h>
struct A { A() { printf("A()\n"); } ~A() { printf("~A()\n"); } };
struct B { B() { printf("B()\n"); } ~B() { printf("~B()\n"); } };
void foo(void* lbl)
{
goto *lbl;
}
int main(int argc, char** argv)
{
void* lbl = &&out;
A a;
foo(lbl);
B b;
out:
return 0;
}
i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
A()
~B()
~A()
B()
~B()
~A()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment