Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I was bored

Name: Ikari Yui 2005-01-14 17:29

...so I wrote something that I won't understand five bits of in 5 years.
See if you can understand what it does without compiling it. It's valid C++, except for the __int64 type, which is Microsoft-specific (replace with whatever your compiler uses).

Have fun.

#include <iostream>
using namespace std;
typedef __int64 pszint; /* FOR 64-BIT POINTERS */
typedef unsigned __int64 uint64;
typedef const char* charptr;

template<typename T> inline void For( T val, const T& end, T (*inc)( const T& ), void (*proc)( const T& ) ) { if( val < end ) { proc( val ); For( inc( val ), end, inc, proc ); } }
template<typename T> inline T If( bool cond, T (*proc)(), T (*eproc)() ) { return ( cond ? proc() : eproc() ); }
template<typename T, typename Q> inline Q Comp( T (*one)(), Q (*two)( const T& ) ) { return two( one() ); }
//template<typename T> inline pszint TypeId() { static T tag; return (pszint) &tag; }

void NullProc() {}
int IncrementInt( const int& i ) { return i + 1; }
uint64 GetValue() { return 36762444129608; /* BIG-ENDIAN */ }
charptr ToString( const uint64& str ) { static uint64 temp; temp = str; return (charptr) &temp; }
charptr GetString() { return Comp<uint64, charptr>( GetValue, ToString ); }
void PrintAndPause( const charptr& str ) { cout << str; getchar(); }
void InnerProc() { Comp<charptr, void>( GetString, PrintAndPause ); }
void Body( const int &i ) { If<void>( i <= 5, InnerProc, NullProc ); }
int main() { For<int>( 1, 10, IncrementInt, Body ); }

Name: Anonymous 2007-06-22 0:05 ID:Heaven

GOODBYE TO THE PAST BITCHES. FUCKING SAGE.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List