
Things to commit before you quit your job - snitko
https://gist.github.com/aras-p/6224951
======
_ak
"Things to commit before you quit your job if you want to get sued your ass
off by your former employer."

------
aras_p
Author of the linked gist here. Some backstory: someone tweeted a "C++ protip:
#define private public" joke. I replied with the excellent "#define struct
union - saves memory!" that I saw somewhere (all valid C programs will still
compile, though not necessarily C++ ones).

And then twitter conversation went to more and more evil suggestions. I just
captured them in the gist.

My favorites are "#define strcpy(a,b) memmove(a,b,strlen(b)+2)" \- which can
go unnoticed in a long, long time; and "#define InterlockedAdd(x,y) (*x+=y)"
\- which would be total hell for someone to debug, as if lockless programming
wouldn't be hard enough already.

~~~
markjdb
> all valid C programs will still compile, though not necessarily C++ ones

I don't think that's true:

    
    
        struct foo {
            int a;
            int b;
        };
    
        char arr[sizeof(struct foo) == sizeof(int) ? -1 : 1];

~~~
aras_p
Ok, proved me wrong! The ones that check for struct sizes at compile time
(like in your example) will fail since sizes will be different now.

------
octo_t

      #define if(x) if ((x) && (rand() < RAND_MAX * 0.99))
    

its pretty awesome. I'm a fan of:

    
    
      #define == =

------
benburleson
Not a good time to submit links to github, I guess.

------
zalzane
oh man I love these.

Here's an old gem I came across a few years back:

[https://gist.github.com/bsamuels453/5819204](https://gist.github.com/bsamuels453/5819204)

This is a bitch to detect if you have a huge project. The #ifndef _DEBUG is
like frosting on the cake. Templates are truly C++'s greatest 'gift'

------
zeckalpha
This calls for hygienic macros.

