Skip to content

Instantly share code, notes, and snippets.

@onqtam
Last active August 29, 2015 14:11
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 onqtam/1aa3e06ca791aff1a82d to your computer and use it in GitHub Desktop.
Save onqtam/1aa3e06ca791aff1a82d to your computer and use it in GitHub Desktop.
#include <cstdio>
#include <cstring>
struct RAII {
~RAII() {
char buf[1000];
memset(buf, 'A', 1000);
}
};
void thrower() {
char buf[10];
sprintf(buf, "KITTIEEEE");
throw buf;
}
int main() {
try {
RAII temp;
thrower();
} catch(char* buf) {
printf(buf);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment