Skip to main content
1 of 2
ecatmur
  • 1.7k
  • 10
  • 15

C++

#include <iostream> #define Q(x,y) x ## y #define P(x,y) Q(x, y) #define print S P(s, __LINE__) = struct S { const char *s; S(const char *s): s(s) {} ~S() { std::cout << s; } }; int main() { print "Line1"; print "Line2"; print "Line3"; print "Line4"; } 

(Local variables are destroyed in reverse order of declaration.)

ecatmur
  • 1.7k
  • 10
  • 15