mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 20:54:41 +03:00
Add fix from issue #122
This commit is contained in:
@@ -1775,7 +1775,7 @@ You could use cyclomatic complexity. Try "more that 10 logical path through." Co
|
|||||||
constexpr int fac(int n)
|
constexpr int fac(int n)
|
||||||
{
|
{
|
||||||
constexpr int max_exp = 17; // constexpr enables this to be used in Expects
|
constexpr int max_exp = 17; // constexpr enables this to be used in Expects
|
||||||
Expects(0<=x && x<max_exp); // prevent silliness and overflow
|
Expects(0<=n && n<max_exp); // prevent silliness and overflow
|
||||||
int x = 1;
|
int x = 1;
|
||||||
for (int i=2; i<=n; ++i) x*= n;
|
for (int i=2; i<=n; ++i) x*= n;
|
||||||
return x;
|
return x;
|
||||||
|
|||||||
Reference in New Issue
Block a user