-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A8-4-7
: Regression with reference types
#82
Comments
For background, this AUTOSAR rule seems poorly conceived. The rule is strictly a performance rule. The rule states that "passing an argument by value documents that the argument won't be modified" but unlike passing by reference to cost eliminates indirection in the function body. From a safety perspective, there is no real advantage in passing by value over passing by reference to const. I'm not sure enforcing this rule adds much if any value, and of course, changing code to comply with a rule always costs efforts and may introduce additional defects. |
The enforcement guidance on which this rule is based "F.16: For “in” parameters, pass cheaply-copied types by value and others by reference to const" says:
This is fairly different enforcement from what we currently have. |
In the example, while the array is trivially copyable it is likely larger than |
Agreed @rcseacord. Testing locally the computed size is 20 bytes and the word size is 8 bytes. So since it is longer than 2 words it is not eligible to be passed by value (under this rule) so it is clearly a false positive, trivially copyable or not. Some more notes on what needs to be fixed:
Example:
|
this might have been solved in this PR , will check |
Affected rules
Description
A false positive has been reported for the example below.
Additionally:
Example
The text was updated successfully, but these errors were encountered: