The mother of all functions!



  • Few years ago I developed an application used for datalogging automotive vehicles. In the meantime, it's been added to. Today I got to see some of these additions.

     

    As I'm going through the source file...I suddenly see something like this:

    if(...insanely long condition)
    {
      3-4 lines of code
    }
    if(...insanely long condition)
    {
      3-4 lines of code
    }
    if(...insanely long condition)
    {
      3-4 lines of code
    }
    if(...insanely long condition)
    {
      3-4 lines of code
    }
    if(...insanely long condition)
    {
      3-4 lines of code
    }
    ....

    I hit page down. I still see the same.

    I hit page down again. Still the same.

    Hit page down about 10 more times, still the same.

    About 20 page downs later, I'm beginning to really go, WTF?

    So I go back to the top of the function. This was C# code in Visual studio so I went and collapsed the function.

    Line # above the function:

    ~5000

    Line # below the collapsed function:

    ~15000

     Yep, that one function had 10,000 lines of code, all of them in the ever repeating pattern as shown above.

     Some people should just simply not be let near a computer, let alone a compiler...



  • I smell auto-generated code.

     



  • Is this function from the c-pound port of this application?



  • And here I was hoping for a function generating function.



  •  @emurphy said:

    I smell auto-generated code.

    Sadly I know who wrote that function and sadly it wasn't auto-generated.


Log in to reply