Such a check would be very noisy when types and typedefs are used interchangeably.
If the code was C++, you could do this to get comilation errors: https://godbolt.org/z/PqrozxKG9
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
is there an option with cppcheck to catch wrong typedef in parameters ?
See the example here, ConvertMeter() and ConvertFeet() with the wrong parameter type.
Thanks.
Such a check would be very noisy when types and typedefs are used interchangeably.
If the code was C++, you could do this to get comilation errors:
https://godbolt.org/z/PqrozxKG9
Hi,
I saw this solution in StackOverflow but with 25+ years old code base with 500+ KLOC (C/C++), it's not my favorite solution.
This is why I am looking for something only for the function parameters. This would reduce the scope to something maybe more manageable.
I have sympathy for this request. Yes it could probably be noisy for normal regular C/C++ code.
I would like to see a "strong type checking" addon in cppcheck.
I wonder if https://github.com/unl-nimbus-lab/phriky-units would catch this problem. However unfortunately that does not seem to be maintained.