Live data from Hacker News

Things to commit just before leaving your job

gist.github.com

1–10 of 165 posts

Re: Things to commit just before leaving your job

#4
From "How to write unmaintainable code" [0], here is a function declaration that changes signature based on how many times the header is #included:

    #ifndef DONE
    #ifdef TWICE
    void g(char* str);
    #define DONE
    #else // TWICE
    #ifdef ONCE
    void g(void* str);
    #define TWICE
    #else // ONCE
    void g(std::string str);
    #define ONCE
    #endif // ONCE
    #endif // TWICE
    #endif // DONE
Granted, it isn't one line long.

[0] https://www.thc.org/root/phun/unmaintain.html (Cert issue shows up on FF unfortunately)

Re: Things to commit just before leaving your job

#6
post #2

We've got a guy in the office that merges the past over the present all the time. He's not quitting but I imagine if you were to try to break things this would be a good way to do it.

Got a offshore guy just like that. Constantly committing his whole project where most files are out of date and only the few he worked on are not.

There's no reason for him to commit javascript files he doesn't even work on the front end. It took me forever to figure out he wrote over my files the other day.

Re: Things to commit just before leaving your job

#9

If only we can get a rosettacode version of this in all languages. I bet trolls will coming out left and right. It would be pure evil.

Most languages don't have a purely textual and completely unsafe preprocessor running during the compilation process, so it would be quite hard.

Re: Things to commit just before leaving your job

#10
post #2

We've got a guy in the office that merges the past over the present all the time. He's not quitting but I imagine if you were to try to break things this would be a good way to do it.

I am curious - wouldn't your Version Control system catch this and warn him that "file xyz has changed since you last checked it out, ..." etc?
Post reply on HN