mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
C++: Rename i to n1 in all examples
I see no reason why the Recommendation and Example sections should use different variable names for the same thing.
This commit is contained in:
@@ -24,20 +24,20 @@ be unsigned. The following cases all fall into the first category.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Given <code>unsigned short i, delta</code> and <code>i + delta < i</code>,
|
||||
it is possible to rewrite it as <code>(unsigned short)(i + delta) < i</code>.
|
||||
Note that <code>i + delta</code> does not actually overflow, due to <code>int</code> promotion.
|
||||
Given <code>unsigned short n1, delta</code> and <code>n1 + delta < n1</code>,
|
||||
it is possible to rewrite it as <code>(unsigned short)(n1 + delta) < n1</code>.
|
||||
Note that <code>n1 + delta</code> does not actually overflow, due to <code>int</code> promotion.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Given <code>unsigned short i, delta</code> and <code>i + delta < i</code>,
|
||||
it is also possible to rewrite it as <code>i > USHORT_MAX - delta</code>. The
|
||||
Given <code>unsigned short n1, delta</code> and <code>n1 + delta < n1</code>,
|
||||
it is also possible to rewrite it as <code>n1 > USHORT_MAX - delta</code>. The
|
||||
<code>limits.h</code> or <code>climits</code> header must then be included.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Given <code>int i, delta</code> and <code>i + delta < i</code>,
|
||||
it is possible to rewrite it as <code>i > INT_MAX - delta</code>. It must be true
|
||||
Given <code>int n1, delta</code> and <code>n1 + delta < n1</code>,
|
||||
it is possible to rewrite it as <code>n1 > INT_MAX - delta</code>. It must be true
|
||||
that <code>delta >= 0</code> and the <code>limits.h</code> or <code>climits</code>
|
||||
header has been included.
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user