C++ Exception Label Escape
#include <stdio.h> struct label { static void* e; label() try : v(({ fprintf(stderr, "oh\n"); e = &&awesome; throw; 42; })) { fprintf(stderr, "no\n"); awesome: fprintf(stderr, "you\n"); } catch(...) { fprintf(stderr, "don't\n"); goto *e; } int v; }; void* label::e; int main() { label l; }
A screenshot of unusual C/C++ code defining a label-like struct with a constructor, exception handling, a computed goto, and the label “awesome.” The joke is that the program prints “oh,” then jumps to “awesome” and prints “you,” while the fallback path prints “no” and “don't,” creating a goofy “oh you awesome / no you don't” exchange. It is used as a reaction by programmers to express awkward admiration or a playful denial. EN: A screenshot of unusual C/C++ code defining a label-like struct with a constructor, exception handling, a computed goto, and the label “awesome.” The joke is that the program prints “oh,” then jumps to “awesome” and prints “you,” while the fallback path prints “no” and “don't,” creating a goofy “oh you awesome / no you don't” exchange. It is used as a reaction by programmers to express awkward admiration or a playful denial.
- @ithueti / 122 2018-02-08
- Type
- image
- Size
- 507×800 · 50.8 KiB
- Mood
- absurd, nerdy
- Language
- en
- Added