Hacker News new | ask | show | jobs
by user5994461 2185 days ago
* goto inside 3 nested for-loops

It's actually a reasonable practice in C and C++ to use goto to leave nested loops (I am hesitating to say a recommended practice).

There is often no sane way to leave the loop otherwise, break/continue statements only have effect in the most inner loop. It's possible to set extra variables with lots of if/break but that gets crazy real quick and much slower (nested loops are often the hot code path).