3 ms·
The article suggests as a replacement for break "but generally extracting a loop to a separate method/function (or at least putting it at the end of existing me
by morganw 15y ago
The article suggests as a replacement for break "but generally extracting a loop to a separate method/function (or at least putting it at the end of existing method) and using return instead will do the trick"
return (from anywhere but the end of a function) is just as damaging to formal verifiability as continue, break or goto.
- pnathan 15y agoEhhh. Continue, break, return at least are well-formed with respect to the local environment. GOTO has no such restrictions (well, in older languages allowing arbitrary GOTOs)... that's why its considered harmful. The single-return principle is used for flowcharts & formal analysis ease. It'd be mildly interesting to do a retrospective of compilation & static analysis algorithms to see what more current research turns up with respect to the single-return rule's use.