Tag Archives: horror

C++ humor: a –do not modify the comments or format– horror code

just in case you think, you can understand what the code is doing by looking at it

executable at Ideone

#include <iostream>
#define B(l,a) __##l##E##__
#define _O_ ((1<<2>>1<<1)-2)
#define _h_ 7-3
#define _C_ (7/_h_)
#define _r_ ((1<<0)+0x00a/2+_C_)
#define _a_ ((1<<5)-_r_)
#define _p_ { void _(){} namespace
#define printf(_0_) squeak(_O_,B(LIN,!)-_a_); _
 
// this
// is weird
 
namespace _p_ {
void squeak(int,int who) {      switch (who) {
                case _O_: std::cout<<"\x71\x75\x61\x6b"<<std::endl; break;
                case (_h_+_C_-2): std::cout<<"\x6d\x65\x6f\x77"<<std::endl; break;
                case _h_: std::cout<<"\x62\x6f\x77"<<std::endl; break;
                default: std::cout<<"\x62\x6c\x61\x68"<<std::endl; break;
        };
}}
}
 
// do not review ...
 
int main()
{
        printf("hello\n");
        printf("this\n");
        printf("is\n");
        printf("not\n");
        printf("funny\n");
        printf("at all!\n");
        return 0;
}
 
//expected output:
//meow
//blah
//quak
//blah
//bow
//blah

 

C++ humor: a –do not modify the comments or format– horror code

executable at Ideone

#include <iostream>
#define B(l,a) __##l##E##__
#define _O_ ((1<<2>>1<<1)-2)
#define _h_ 7-3
#define _C_ (7/_h_)
#define _r_ ((1<<0)+0x00a/2+_C_)
#define _a_ ((1<<5)-_r_)
#define _p_ { void _(){} namespace
#define printf(_0_) squeak(_O_,B(LIN,!)-_a_); _
 
// this
// is weird
 
namespace _p_ {
void squeak(int,int who) {      switch (who) {
                case _O_: std::cout<<"quak"<<std::endl; break;
                case (_h_+_C_-2): std::cout<<"meow"<<std::endl; break;
                case _h_: std::cout<<"bow"<<std::endl; break;
                default: std::cout<<"blah"<<std::endl; break;
        };
}}
}
 
// do not review ...
 
int main()
{
        printf("hello\n");
        printf("this\n");
        printf("is\n");
        printf("not\n");
        printf("funny\n");
        printf("at all!\n");
        return 0;
}
 
//expected output:
//meow
//blah
//quak
//blah
//bow
//blah