C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Bringing break/continue with label to C++

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Fri, 20 Dec 2024 15:58:28 +0000

> The last step in this argument seems highly speculative. As I see it, there is a strong cultural norm against using `goto`, and people are able to avoid using `goto` even though they already use labels (i.e. in `switch` statements), so, I do not see why adding labels in more places would make the situation any worse.

Until now a label just meant a singularly well-defined point that can be jumped to (either it be a case: or a user defined label: ). Now it no longer means that, it could potentially mean 3 different jump points, 1 of which has nothing to do with the structured way we have been using constructs such break and continue in a for loop.

Can you make this work? I guess you can.
Should you make it work in this way?
Remember you are just trying to answer the question “break where” and “continue what loop”, and the fact that you could also use goto to access it is a side-effect that nobody finds desirable, the question is either or not you can look the other way.

Received on 2024-12-20 15:58:31