Closed kunaltyagi closed 1 year ago
One solution might be to enable modernize-use-default-member-init
in #4249
Or a new PR. That one is already huge
Hello @kunaltyagi, Where can i find the report/log for the 16 instances? The coday of fork link is broken/expired.
Hi @theoniko ! I recently fixed some of these instances in my pull request https://github.com/PointCloudLibrary/pcl/pull/5448 I used cppcheck to detect these, which I assume codacy used as well. Here is a list of remaining instances (note: in-class initialization could be an alternative to initialization in the initialization list. I would also disregard issues in 3rd-party code for now)
/home/markus/pcl/filters/include/pcl/filters/fast_bilateral.h:123:13: performance: Variable 'v_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/features/include/pcl/features/grsd.h:93:9: performance: Variable 'relative_coordinates_all_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/visualization/src/image_viewer.cpp:68:3: performance: Variable 'interactor_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/visualization/src/pcl_plotter.cpp:69:3: performance: Variable 'view_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/surface/include/pcl/surface/3rdparty/poisson4/geometry.h:223:75: performance: Variable 'start' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/surface/include/pcl/surface/3rdparty/poisson4/geometry.h:223:87: performance: Variable 'end' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/surface/include/pcl/surface/3rdparty/poisson4/geometry.h:226:15: performance: Variable 'start' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/surface/include/pcl/surface/3rdparty/poisson4/geometry.h:226:27: performance: Variable 'end' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/recognition/src/cg/hough_3d.cpp:52:3: performance: Variable 'min_coord_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/recognition/src/cg/hough_3d.cpp:53:3: performance: Variable 'bin_size_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/common/include/pcl/common/impl/random.hpp:116:3: performance: Variable 'parameters_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/common/include/pcl/common/impl/random.hpp:56:3: performance: Variable 'parameters_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/recognition/include/pcl/recognition/face_detection/rf_face_detector_trainer.h:63:9: performance: Variable 'forest_filename_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/stereo/src/stereo_grabber.cpp:103:3: performance: Variable 'pair_files_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/octree/include/pcl/octree/octree_nodes.h:89:5: performance: Variable 'container_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/octree/include/pcl/octree/octree_nodes.h:186:5: performance: Variable 'child_node_array_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/octree/include/pcl/octree/octree_nodes.h:192:5: performance: Variable 'child_node_array_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/outofcore/src/visualization/camera.cpp:26:3: performance: Variable 'camera_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/outofcore/src/visualization/camera.cpp:49:3: performance: Variable 'camera_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/outofcore/src/visualization/viewport.cpp:29:3: performance: Variable 'renderer_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/simulation/src/model.cpp:293:3: performance: Variable 'program_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/simulation/src/glsl_shader.cpp:33:46: performance: Variable 'program_id_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/simulation/src/sum_reduce.cpp:11:3: performance: Variable 'sum_program_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/test/search/test_organized.cpp:59:5: performance: Variable 'point_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
/home/markus/pcl/test/search/test_organized_index.cpp:59:7: performance: Variable 'point_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
Context
PCL has ctor performing initialization of data members which could lead to needless memory allocations.
Describe the solution you'd like
Perform initialization before ctor body in initializer list
Additional context
Only 16 such instances are present: Coday of fork