-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Parameter pass-by-value heuristic: trivial copyability issue, and incomplete type issue #2112
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
Comments
Is the (harder) enforcement needed? Is it true that incomplete types can't be passed by value so the rule wouldn't apply? Also, would relaxing the enforcement some by only warning |
tl; dr I've misread, and didn't consider this suggestion is specifically for not taking ownership. I think (easy) is a good explanation, but It's probably best to shift the line to approximately one cache line. For example,
|
I'm not well versed with calling conventions outside of x86_64, but the trend is definitely going towards more registers in general. IIRC RISC-V has 64 GPRs, and Intel's new APX extension is expanding the number of GPRs from 16 to 32. I'm unsure if this changes much about calling conventions, however, at a surface level, it is becoming more practical to pass larger objects by value. My suggestion is: -warn on > 2 * sizeof(void*) passed by value
+warn on > 8 * sizeof(void*) passed by value and |
F.16 is about "in" parameters. |
Note that enumerations can't be forward declared. |
F.16 says:
Two problems that have come up with this advice:
The text was updated successfully, but these errors were encountered: