You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While there, it may be beneficial to audit the existing standard -- it hasn't been meaningfully revisited in 8 years (for better or worse) -- and see how these newer features could change the current guidelines.
Moreover, the standard for return states that multiple return points should be avoided. Despite the standard attempting to back this statement up with [multiple return points] can make the flow of code more difficult to understand, I'd argue the opposite; avoiding multiple return points often leads to unnecessary complexity in control flow and, in the presence of goto, complexity in variable declarations and brittleness that is counter to modern C++.
In particular, procedures that require manual cleanup are often riddled with goto done and deep nesting. With the support of lambdas, an alternative approach could be to define lambdas with cleanup code and have early returns accompanied by calls to the cleanup lambda, leading to flatter, more understandable procedures.
The text was updated successfully, but these errors were encountered:
Given the updated supported-feature list for C++11 (#7369) (edit: still updating), we should revisit the coding standards (https://github.com/eclipse/omr/blob/master/doc/CodingStandard.md) and add in guidelines and standards for newer features e.g.
nullptr
and lambdas.While there, it may be beneficial to audit the existing standard -- it hasn't been meaningfully revisited in 8 years (for better or worse) -- and see how these newer features could change the current guidelines.
Moreover, the standard for
return
states that multiple return points should be avoided. Despite the standard attempting to back this statement up with[multiple return points] can make the flow of code more difficult to understand
, I'd argue the opposite; avoiding multiple return points often leads to unnecessary complexity in control flow and, in the presence ofgoto
, complexity in variable declarations and brittleness that is counter to modern C++.In particular, procedures that require manual cleanup are often riddled with
goto done
and deep nesting. With the support of lambdas, an alternative approach could be to define lambdas with cleanup code and have early returns accompanied by calls to the cleanup lambda, leading to flatter, more understandable procedures.The text was updated successfully, but these errors were encountered: