Inspired by http://madebyevan.com/obscure-cpp-features/. Compile and run using g++ or clang++.
$ g++ -std=c++11 -Wall -pedantic -Wextra wat.cpp
$ ./a.out
hello! I'm called ./a.out and 5 + 3 is 8
Inspired by http://madebyevan.com/obscure-cpp-features/. Compile and run using g++ or clang++.
$ g++ -std=c++11 -Wall -pedantic -Wextra wat.cpp
$ ./a.out
hello! I'm called ./a.out and 5 + 3 is 8
| ??=include <iostream> | |
| namespace _ ??< | |
| struct _ <% | |
| bool __ = <%%>; | |
| ~_() ??< std::cout << std::endl; ??> | |
| template<class ___> auto operator,(___ const bitand _) -> ::_::_ bitand <% | |
| if(__ or not compl __) std::cout << ' '; | |
| __ xor_eq compl __; | |
| std::cout << _; | |
| return *this; | |
| %> | |
| %>; | |
| ??> | |
| %:define print ??/ | |
| _::_<%%>, | |
| int main(int, char** argv) ??< | |
| print "hello!", | |
| "I'm called", 0<:argv:>, | |
| "and 5 + 3 is", 5 + 3; | |
| return 0; | |
| ??> |