How to avoid use of goto and break nested loops efficiently [closed]
问题 I'd say that it's a fact that using goto is considered a bad practice when it comes to programming in C/C++. However, given the following code for (i = 0; i < N; ++i) { for (j = 0; j < N; j++) { for (k = 0; k < N; ++k) { ... if (condition) goto out; ... } } } out: ... I wonder how to achieve the same behavior efficiently not using goto . What i mean is that we could do something like checking condition at the end of every loop, for example, but AFAIK goto will generate just one assembly