• (nodebb)

    I love the bonus exception handlers

    I would have called them "non-handlers", since they just immediately re-throw the thing they caught, without doing anything with it.

  • (nodebb)

    This is another project operating under the lines of code metric.

  • (nodebb)

    Gotta at least give them credit for rethrowing them correctly. "throw ex" destroys the stack trace (resets it to the new location). A plain "throw" statement preserves that stack trace.

  • DaveD (unregistered) in reply to colejohnson66

    Maybe they didn't know about "throw ex"

  • (nodebb)

    Usually these looks like debugging code (i.e. breakpoint fodder) but here there is nothing to debug.

  • (nodebb) in reply to Steve_The_Cynic

    doing nothing and kicking all problems down the line? this must have been coded by a manager.

  • (nodebb) in reply to DaveD

    Maybe they didn't know about "throw ex"

    Don't throw your ex.

  • LZ79LRU (unregistered) in reply to R3D3

    Unless she is shorter than 147 cm at which point it becomes a sport.

  • Brian (unregistered)

    Smells to me like a function stub, possibly generated from a template or something, but nobody ever bothered to fill in the details.

  • matt (unregistered)

    That led. The past tense (and past participle) of lead is led.

  • Appalled (unregistered)

    So find every place that calls it, delete the calls, then delete the method. EZPZ.

  • Oracles (unregistered)

    Obviously another case of a paid-by-the-line contract.

  • (nodebb)

    Typical case of "paid by line of code" ?

    Addendum 2023-11-29 17:43: Looks like nearly everyone here had the same thought lol

  • (nodebb)

    In a serious note, creating exception scope is both under windows and linux expensive even if you don't throw an exception (which is super expensive). And for legacy reason the compiler will only remove completely empty exception handlers, as soon as you have any meaningful code like this assignment, you literally have the most expensive assignment that does nothing. Okay, maybe there's way to make it speed up global warming even more, but technically there's never a limit.

  • (nodebb) in reply to matt

    Thanks for illuminating that topic!

  • (nodebb)

    Is it possible the compiler will see that the variable is assigned to, but never used, and that the assignment can't possibly raise an exception? Not that I'm an advocate for letting monkeys bash at their keyboards and hoping the compiler will be clever enough to fix their nonsense for them.

  • DeeKay (unregistered)
    Comment held for moderation.
  • (nodebb) in reply to Appalled

    delete the calls, then delete the method

    Even better, delete the method, and see if it all builds and tests correctly (assuming they have unit tests). Chances are nothing is even calling that method.

  • (nodebb) in reply to Ralf

    delete the calls, then delete the method

    Even better, delete the method, and see if it all builds and tests correctly (assuming they have unit tests). Chances are nothing is even calling that method.

    I wanted to speculate, that maybe it overrides something and is needed to be there at least as an empty method. Then I saw³ that is a private method.

    Even without unit tests, it should be safe to remove the function.

  • TheCPUWizard (unregistered)
    Comment held for moderation.
  • Gnasher729 (unregistered) in reply to Appalled

    Before you delete the calls, make sure you call each one when fields are filled and see if not clearing any fields is a bug.

  • Hamza (unregistered)
    Comment held for moderation.
  • Shorty (unregistered) in reply to Steve_The_Cynic
    Comment held for moderation.

Leave a comment on “A Caught Return”

Log In or post as a guest

Replying to comment #:

« Return to Article