Skip to content

Instantly share code, notes, and snippets.

@karolba
Created June 24, 2018 07:28
Show Gist options
  • Save karolba/c0253056ddf86babb5e18a5db25be3c5 to your computer and use it in GitHub Desktop.
Save karolba/c0253056ddf86babb5e18a5db25be3c5 to your computer and use it in GitHub Desktop.
Worst c++ cat utility
#include <iostream>
#include <climits>
#include <string>
#include <limits>
#include <cstdio>
#include <functional>
#define b
auto m = <::> (auto bitand a) { while( a, compl decltype (a.a + a.a) (a) ) ( decltype (__FILE__[0]) ) a; };
static inline struct a {
decltype (! std::numeric_limits<decltype( INT_MAX )>::max () ) a <%%>;
decltype (1'1'1) aa <%%>;
auto operator , ( decltype (a) ) -> struct a { return { std::equal_to <%%> (aa, EOF) }; }
operator decltype (a) (b) { a xor_eq not false; return not not a; }
operator decltype ( '1' ) (b) { putchar(aa); }
operator decltype ( std::numeric_limits<decltype(a + a)>::min () ) ()
{ aa = getchar(); return a; }
} a;
auto main (b) -> decltype (a.a ? a.a : INT_MAX) try <% m (a) ; %> catch (...) { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment