Archived issue #0032903
Coding Rules - eliminate MSVC warning C26451 on VS2019/C++20
Description
When C++20 enables, warning messages occures:
Put explicit type casting to avoid: Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
Put explicit type casting to avoid: Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
Steps to reproduce
Not required
Public activity
15 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Author.
[revision removed]
Detailed log of new commits:
Author: Dmitry DZAMA
Date: Tue Mar 29 16:32:46 2022 +0300
0032903: Get rid of warning message C26451 on VS 2019/C++20
Put explicit type casting to avoid:
When C++20 enables, warning messages occures:
Put explicit type casting to avoid:
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte
value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
[revision removed]
Detailed log of new commits:
Author: Dmitry DZAMA
Date: Tue Mar 29 16:32:46 2022 +0300
0032903: Get rid of warning message C26451 on VS 2019/C++20
Put explicit type casting to avoid:
When C++20 enables, warning messages occures:
Put explicit type casting to avoid:
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte
value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
Branch [archived branch] has been deleted by Author.
[revision removed]
[revision removed]
Branch [archived branch] has been created by Author.
[revision removed]
Detailed log of new commits:
Author: Dmitry DZAMA
Date: Tue Mar 29 16:32:46 2022 +0300
0032903: Get rid of warning message C26451 on VS 2019/C++20
Put explicit type casting to avoid:
When C++20 enables, warning messages occures:
Put explicit type casting to avoid:
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte
value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
[revision removed]
Detailed log of new commits:
Author: Dmitry DZAMA
Date: Tue Mar 29 16:32:46 2022 +0300
0032903: Get rid of warning message C26451 on VS 2019/C++20
Put explicit type casting to avoid:
When C++20 enables, warning messages occures:
Put explicit type casting to avoid:
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte
value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
there should be no "merge" commits in the patch,
+ const double aDelta_x = (double)(aDelta.x()); + const double aDelta_y = (double)(aDelta.y());
Graphic3d_Vec2d aDeltaF (aDelta);
+ if ( std::fabs(aDelta_x) + std::fabs(aDelta_y) > aPanTol )
Abs()
In addition, patch has to be rebased onto current IR / updated next week as IR includes modification in the same place.
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
Branch [archived branch] has been created by Commenter 2.
[revision removed]
Detailed log of new commits:
Author: Dmitry DZAMA
Date: Tue Mar 29 16:32:46 2022 +0300
0032903: Coding Rules - eliminate MSVC warning C26451 on VS2019/C++20
Put explicit type casting to avoid:
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte
value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
[revision removed]
Detailed log of new commits:
Author: Dmitry DZAMA
Date: Tue Mar 29 16:32:46 2022 +0300
0032903: Coding Rules - eliminate MSVC warning C26451 on VS2019/C++20
Put explicit type casting to avoid:
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte
value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
Please raise the patch
- OCCT: branch CR32903_1.
- OCCT: branch CR32903_1.
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18668.100000000675 / 18636.43000000061 [+0.17%]
Products
Total CPU difference: 11742.710000000114 / 11717.180000000135 [+0.22%]
Windows-64-VC14:
OCCT
Total CPU difference: 20733.796875 / 20693.28125 [+0.20%]
Products
Total CPU difference: 13272.875 / 13248.015625 [+0.19%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18668.100000000675 / 18636.43000000061 [+0.17%]
Products
Total CPU difference: 11742.710000000114 / 11717.180000000135 [+0.22%]
Windows-64-VC14:
OCCT
Total CPU difference: 20733.796875 / 20693.28125 [+0.20%]
Products
Total CPU difference: 13272.875 / 13248.015625 [+0.19%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Related records