forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50f9580
commit 9e02bc1
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE qhelp PUBLIC | ||
"-//Semmle//qhelp//EN" | ||
"qhelp.dtd"> | ||
<qhelp> | ||
|
||
<overview> | ||
<p>The C++ standard library provides a large selection of math functions. | ||
These functions are available for use either in the std namespace or in the global namespace.</p> | ||
|
||
<p>In order to highlight invocations of the standard library and avoid occasional | ||
definitional differences of these functions, we prefer to avoid use of the functions in the global namespace.</p> | ||
|
||
</overview> | ||
<recommendation> | ||
|
||
<p>Prefer to invoke the functions defined in the std namespace.</p> | ||
|
||
</recommendation> | ||
<example> | ||
|
||
<p>Most current c++ standard libraries will allow invoking math functions in the global namespace</p> | ||
<code> | ||
#include <cmath> | ||
|
||
float my_pow( float base, float exp ) { | ||
return pow( base, exp ); | ||
} | ||
</code> | ||
|
||
<p>Prefer invoking the version in the std namespace.</p> | ||
<code> | ||
#include <cmath> | ||
|
||
float my_pow( float base, float exp ) { | ||
return std::pow( base, exp ); | ||
} | ||
</code> | ||
|
||
</example> | ||
<references> | ||
|
||
<li> | ||
Informative Stack Exchange Answer: | ||
<a href="https://stackoverflow.com/a/8734292/280690">Differences between math.h and cmath</a>. | ||
</li> | ||
|
||
</references> | ||
</qhelp> |