Archived issue #0025621
CAST analysis: Avoid constructors not supplying an initial value for all non-static data members
Description
Each constructor must initialize all member data items. Explicit initialization reduces the risk of an invalid state after successful construction. All virtual base classes, direct non-virtual base classes and non-static data members should be included in the initialization list for the constructor. For many constructors this means that the body becomes an empty block.
Steps to reproduce
not applicable
Additional information
More details: CAST report, issue 7932
Public activity
7 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: Author
Date: Thu Dec 25 10:00:13 2014 +0300
0025621: CAST analysis: Avoid constructors not supplying an initial value for all non-static data members
The constructors of classes from following files have been fixed:
Adaptor2d_Line2d.cxx
Adaptor3d_IsoCurve.cxx
Adaptor3d_OffsetCurve.cxx
AdvApp2Var_ApproxAFunc2Var.cxx
AIS_Dimension.cxx
AIS_InteractiveContext.cxx
Aspect_DisplayConnection.cxx
BiTgte_CurveOnEdge.cxx
BiTgte_CurveOnVertex.cxx
BRepAdaptor_CompCurve.cxx
BRepMesh_Circle.hxx
BRepMesh_Delaun.cxx
BRepToIGES_BREntity.cxx
ChFi2d_AnaFilletAlgo.cxx
ChFi2d_ChamferAPI.cxx
ChFi2d_FilletAlgo.cxx
ChFi2d_FilletAlgo.hxx
Extrema_ExtPExtS.cxx
Font_FTFont.cxx
GccEnt_QualifiedCirc.cxx
Geom2dAdaptor_Curve.cxx
IGESData_IGESEntity.cxx
IGESData_DefSwitch.cxx
IGESToBRep_CurveAndSurface.cxx
LDOM_XmlReader.cxx
math_TrigonometricFunctionRoots.cxx
NCollection_ListNode.hxx
ProjLib_CompProjectedCurve.cxx
ProjLib_ComputeApproxOnPolarSurface.cxx
Select3D_Box2d.hxx
Select3D_PointData.hxx
[revision removed]
Detailed log of new commits:
Author: Author
Date: Thu Dec 25 10:00:13 2014 +0300
0025621: CAST analysis: Avoid constructors not supplying an initial value for all non-static data members
The constructors of classes from following files have been fixed:
Adaptor2d_Line2d.cxx
Adaptor3d_IsoCurve.cxx
Adaptor3d_OffsetCurve.cxx
AdvApp2Var_ApproxAFunc2Var.cxx
AIS_Dimension.cxx
AIS_InteractiveContext.cxx
Aspect_DisplayConnection.cxx
BiTgte_CurveOnEdge.cxx
BiTgte_CurveOnVertex.cxx
BRepAdaptor_CompCurve.cxx
BRepMesh_Circle.hxx
BRepMesh_Delaun.cxx
BRepToIGES_BREntity.cxx
ChFi2d_AnaFilletAlgo.cxx
ChFi2d_ChamferAPI.cxx
ChFi2d_FilletAlgo.cxx
ChFi2d_FilletAlgo.hxx
Extrema_ExtPExtS.cxx
Font_FTFont.cxx
GccEnt_QualifiedCirc.cxx
Geom2dAdaptor_Curve.cxx
IGESData_IGESEntity.cxx
IGESData_DefSwitch.cxx
IGESToBRep_CurveAndSurface.cxx
LDOM_XmlReader.cxx
math_TrigonometricFunctionRoots.cxx
NCollection_ListNode.hxx
ProjLib_CompProjectedCurve.cxx
ProjLib_ComputeApproxOnPolarSurface.cxx
Select3D_Box2d.hxx
Select3D_PointData.hxx
First remark, in Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve:
- first: there should be no need to initialize myCurve by NULL, it is handle and has default constructor
- second: myFirst and myLast are mot set properly
- first: there should be no need to initialize myCurve by NULL, it is handle and has default constructor
- second: myFirst and myLast are mot set properly
Branch [archived branch] has been updated by Author.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Thu Dec 25 16:05:28 2014 +0300
0025621: CAST analysis: Avoid constructors not supplying an initial value for all non-static data members
Delete Handles initializations.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Thu Dec 25 16:05:28 2014 +0300
0025621: CAST analysis: Avoid constructors not supplying an initial value for all non-static data members
Delete Handles initializations.
No remarks, please test
Dear BugMaster,
Branch CR25621 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 18 (18 on master)
Windows: 0 (0 on master)
products component :
Linux: 11 (11 on master)
Windows: 1 (1 on master)
Regressions/Differences:
No regressions/differences
Testing cases:
Not needed
Testing on Linux:
occt component :
Total MEMORY difference: 367272204 / 367862128
Total CPU difference: 48803.300000000294 / 51444.81000000015
products component :
Total MEMORY difference: 112391796 / 112474236
Total CPU difference: 16460.709999999977 / 16870.879999999983
Testing on Windows:
occt component :
Total MEMORY difference: 277460644 / 277277864
Total CPU difference: 34788.3125 / 37472.0935757
products component :
Total MEMORY difference: 72282380 / 71352468
Total CPU difference: 10229.046875 / 10337.547159399997
There are no differences in images found by testdiff.
Branch CR25621 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 18 (18 on master)
Windows: 0 (0 on master)
products component :
Linux: 11 (11 on master)
Windows: 1 (1 on master)
Regressions/Differences:
No regressions/differences
Testing cases:
Not needed
Testing on Linux:
occt component :
Total MEMORY difference: 367272204 / 367862128
Total CPU difference: 48803.300000000294 / 51444.81000000015
products component :
Total MEMORY difference: 112391796 / 112474236
Total CPU difference: 16460.709999999977 / 16870.879999999983
Testing on Windows:
occt component :
Total MEMORY difference: 277460644 / 277277864
Total CPU difference: 34788.3125 / 37472.0935757
products component :
Total MEMORY difference: 72282380 / 71352468
Total CPU difference: 10229.046875 / 10337.547159399997
There are no differences in images found by testdiff.
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]