Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6bdfebe

Browse files
committed
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.
1 parent 9b89602 commit 6bdfebe

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

cpp/ql/src/Likely Bugs/Arithmetic/SignedOverflowCheck.qhelp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ be unsigned. The following cases all fall into the first category.
2424
</p>
2525

2626
<p>
27-
Given <code>unsigned short i, delta</code> and <code>i + delta &lt; i</code>,
28-
it is possible to rewrite it as <code>(unsigned short)(i + delta)&nbsp;&lt;&nbsp;i</code>.
29-
Note that <code>i + delta</code> does not actually overflow, due to <code>int</code> promotion.
27+
Given <code>unsigned short n1, delta</code> and <code>n1 + delta &lt; n1</code>,
28+
it is possible to rewrite it as <code>(unsigned short)(n1 + delta)&nbsp;&lt;&nbsp;n1</code>.
29+
Note that <code>n1 + delta</code> does not actually overflow, due to <code>int</code> promotion.
3030
</p>
3131

3232
<p>
33-
Given <code>unsigned short i, delta</code> and <code>i + delta &lt; i</code>,
34-
it is also possible to rewrite it as <code>i &gt; USHORT_MAX - delta</code>. The
33+
Given <code>unsigned short n1, delta</code> and <code>n1 + delta &lt; n1</code>,
34+
it is also possible to rewrite it as <code>n1 &gt; USHORT_MAX - delta</code>. The
3535
<code>limits.h</code> or <code>climits</code> header must then be included.
3636
</p>
3737

3838
<p>
39-
Given <code>int i, delta</code> and <code>i + delta &lt; i</code>,
40-
it is possible to rewrite it as <code>i &gt; INT_MAX - delta</code>. It must be true
39+
Given <code>int n1, delta</code> and <code>n1 + delta &lt; n1</code>,
40+
it is possible to rewrite it as <code>n1 &gt; INT_MAX - delta</code>. It must be true
4141
that <code>delta &gt;= 0</code> and the <code>limits.h</code> or <code>climits</code>
4242
header has been included.
4343
</p>

0 commit comments

Comments
 (0)