Created
February 4, 2014 22:01
-
-
Save kylesluder/8813227 to your computer and use it in GitHub Desktop.
Neither of these runs the cleanup function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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