On a pull request I worked on, cppcheck (version 1.80) showed a suggestion to use references on a C API when references do not exist in C.
The source code scanned can be found here, and the messages I got were the following:
[modules/nativescript/godot_nativescript.cpp:52]: (performance) Function parameter 'p_create_func' should be passed by reference.
[modules/nativescript/godot_nativescript.cpp:52]: (performance) Function parameter 'p_destroy_func' should be passed by reference.
[modules/nativescript/godot_nativescript.cpp:77]: (performance) Function parameter 'p_create_func' should be passed by reference.
[modules/nativescript/godot_nativescript.cpp:77]: (performance) Function parameter 'p_destroy_func' should be passed by reference.
[modules/nativescript/godot_nativescript.cpp:101]: (performance) Function parameter 'p_method' should be passed by reference.
[modules/nativescript/godot_nativescript.cpp:120]: (performance) Function parameter 'p_set_func' should be passed by reference.
[modules/nativescript/godot_nativescript.cpp:120]: (performance) Function parameter 'p_get_func' should be passed by reference.
I did some performance tests to check if there was a performance gain anyway, but so far I do not see it. I think this might be a bug.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if it is C code then the cpp extension is confusing. the --language option can be used if you don't want c++ warnings.
I did some performance tests to check if there was a performance gain anyway, but so far I do not see it. I think this might be a bug.
there can be performance gains.
The "performance" messages is for generic suboptimisations. I think that profiling and fixing actual performance issues will give you more noticeable improvements.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks a lot for the clarification! And thanks a lot for this awesome static analyzer!
I got to say, most of the time the most important cppcheck messages I've seen are spot-on and they work with barely any configuration at all. I've used cppcheck every now and then for about a year now and it's amazing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On a pull request I worked on,
cppcheck
(version 1.80) showed a suggestion to use references on a C API when references do not exist in C.The source code scanned can be found here, and the messages I got were the following:
I did some performance tests to check if there was a performance gain anyway, but so far I do not see it. I think this might be a bug.
if it is C code then the cpp extension is confusing. the --language option can be used if you don't want c++ warnings.
there can be performance gains.
The "performance" messages is for generic suboptimisations. I think that profiling and fixing actual performance issues will give you more noticeable improvements.
Thanks a lot for the clarification! And thanks a lot for this awesome static analyzer!
I got to say, most of the time the most important
cppcheck
messages I've seen are spot-on and they work with barely any configuration at all. I've usedcppcheck
every now and then for about a year now and it's amazing.