Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)



I honestly believe that one of the CTOs at my previous employer has followed that guide to ensure the security of his job.

He wrote an entire custom framework for their SaaS platform. I couldn't believe my eyes when I started work on it. I think I lasted 4 weeks before I gave them my 2 weeks notice.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: