Skip to content

Instantly share code, notes, and snippets.

@kylesluder
Created February 4, 2014 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylesluder/8813227 to your computer and use it in GitHub Desktop.
Save kylesluder/8813227 to your computer and use it in GitHub Desktop.
Neither of these runs the cleanup function
#include <stdio.h>
static void cleanup_func(int *foo)
{
printf("cleanup! %d\n", *foo);
}
int main(int argc, char **argv)
{
return 0;
int foo __attribute__((cleanup(cleanup_func))) = 1;
return foo;
}
#include <stdio.h>
class cleanup
{
public:
~cleanup();
};
cleanup::~cleanup()
{
printf("cleanup!");
}
int main(int argc, char **argv)
{
return 0;
cleanup c;
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment