Archived issue #0032917

Coding Rules - eliminate MSVS warning C26440 on VS2019/C++20 (If your function may not throw, declare it noexcept)

Open CASCADEOCCT:Codingclosed13 public notes

Search issues

Description

Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of warning C26440: "If your function may not throw, declare it noexcept"

"If code is not supposed to cause any exceptions,
it should be marked as such by using the 'noexcept' specifier.
This would help to simplify error handling on the client code side,
as well as enable compiler to do additional optimizations."

Steps to reproduce

Not required

Public activity

13 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Dmitry DZAMA
Date: Thu Mar 31 09:21:08 2022 +0300

    0032917: Coding Rules - eliminate MSVS2019 warning C26440 (If your function may not throw, declare it noexcept)
    
    Microsoft Visual Studio Professional 2019
    Version 16.11.11
    std=c++20
    
    Get rid of warning C26440: "If your function may not throw, declare it noexcept"
    
    "If code is not supposed to cause any exceptions,
    it should be marked as such by using the 'noexcept' specifier.
    This would help to simplify error handling on the client code side,
    as well as enable compiler to do additional optimizations."
02Commenter 1
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
03Commenter 1
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
04Commenter 2
Commenter 3, could you please check proposed patch?
05Commenter 4
Commenter 4, please clarify 2 things:
1. C26440 is generated for move operators only.
2. Please check replacement possibility `noexcept(true)` -> `noexcept` to reduce syntax sugar.
06Commenter 1
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
07Commenter 1
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
08Commenter 3
Commenter 3
1. In MSVC documentation are not any information relating std::move operand and generating that warning.
2. Yes, noexcept may be used instead noexcept(true)
09Commenter 4
Commenter 4

Please proceed with the point number two.
10Commenter 1
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
11Commenter 11
Reviewed. Please raise the patch.

OCCT - CR32917
Products - NOT
12Commenter 12
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
13Commenter 1
Branch [archived branch] has been deleted by Commenter 5.

[revision removed]

Related records