News for hackers. Stuff that matters.
Re:We Are Sorry to Inform You (2005) by ncmncm on Saturday June 18, 2022 @09:57AM (#31789868)
It has been, literally, many decades since I last found a place where C++ code would benefit from use of a goto statement.

Those few places where they appear in (what would have been) defensible C code are better served by reliance on destructors. I.e., it is much better to start compiling the C code with a C++ compiler, and then clean it up.

Re:We Are Sorry to Inform You (2005) by dataflow on Saturday June 18, 2022 @02:25PM (#31792424)
I've come across a couple of (admittedly niche) cases where C++ code benefits from a goto:

- In some very performance sensitive cases. It helps you skip a bunch of extra checks or variables.

- When you need to convert recursion to iteration, but want to keep the code structure mostly intact so you don't mess up the source control history.

Re:We Are Sorry to Inform You (2005) by ncmncm on Sunday June 19, 2022 @11:13PM (#31805923)
Agree, minimizing diffs (even indentation!) is a necessary evil.

Nowadays I will use lambdas that return early in preference to goto. Not from fastidiousness so much as to avoid confusing the optimizer.

Poster child for reprehensible use of goto is procmail.

Re:We Are Sorry to Inform You (2005) by andi999 on Tuesday June 21, 2022 @03:43PM (#31828250)
Destructor are not allowed to throw exceptions, so you cam only do stuff that guarantees not to throw.