1

Comment your weirdest code review experiences, let the world hear.

Comments
  • 2
    I insist on writing comments. There is this girl who I had worked with. I was reviewing her code which was:

    if(true == HMI_waitEvent()) {
    //Should always return true
    return false;
    }

    I was like, WHY!??
  • 0
    Remember me times when i did foreach for test if some element is in array. Fun times.
  • 6
    I was once asked to debug some robotics code in C. Control systems, gnarly mathematics-heavy stuff. The thing had a lot of functions that seemed to be behaving weirdly and failing all over the place, and arm-gcc was giving very strange errors. It would throw syntax errors but the syntax looked okay to me.

    Checked the header file.

    They weren't functions, they were #define-s. Every single one of them. With a ton of stringification and token pasting and all that jazz. Turned out a year ago some psychotic motherfucker wrapped up the entire design into #define-ed chunks and was using them like functions. So naturally when the current devs tried modifying anything it would break all over the place. Apparently he believed functions would hurt performance because this code was running on a tiny microcontroller.

    ngl it had some cool hacks in there but we ended up rewriting it with functions and with some inlining help and flag-tuning the code was actually faster (and orders of magnitude cleaner). Because, you know, compilers.
  • 1
    @RememberMe haha, epic!
  • 2
    I once used an array of variable names in some file in PHP, and used the $$var magic to turn them into vars. Why? So I could copy/paste the code into a different file and use it there, too, and only change the variable names.

    ... yep.

    And somehow I thought this was a good idea.

    Less “live and learn,” more “live and embarrass yourself forever with memories.”
  • 1
    @Root every ingenious idea will at some point fall apart 😄
    I've done similar shit early in my career... and if you look back, it seemed great but then you know better and not to do it again.
Add Comment