Deep nesting vs early returns

Johan Engelen j at j.nl
Tue Oct 9 16:25:17 UTC 2018


On Tuesday, 2 October 2018 at 18:14:55 UTC, Andrei Alexandrescu 
wrote:
> Kate Gregory makes a good argument on something I've often 
> commented in code reviews: https://youtu.be/n0Ak6xtVXno?t=2682

I very much like LLVM's practices, and one of them is it's Coding 
Standards.
It prescribes early returns:
https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code

It adds "use continue" to the early returns advice.  (The 
equivalent of "early returns" in loops.)

-Johan



More information about the Digitalmars-d mailing list