Advertisement
homer512

print self

May 14th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. /**
  4.  * Print-eval
  5.  *
  6.  * Writes code as string to stdout, then executes it in current context
  7.  */
  8. #define PE(code) std::cout << #code << std::endl; code
  9.  
  10. int main()
  11. {
  12.   PE(int x = 5;)
  13.   PE(x += 3;)
  14.   PE(for(int i = 0; i < 3; ++i)
  15.      {
  16.        x += 2;
  17.      }
  18.   )
  19.   PE(return x;)
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement