AUTOSAR C++14 Rule A5-1-3
Parameter list (possibly empty) shall be included in every lambda expression
Description
Parameter list (possibly empty) shall be included in every lambda expression.
Rationale
You do not have to include a parameter list in a lambda expression. For instance, this expression is syntactically valid and indicates a closure that can be called without parameters:
[&counter] {
++counter;
}(), you or a reviewer might not recognize this as a function object.
It is visually clearer to use the parameter list (...) even when the list
is empty. For
instance:[&counter]() {
++counter;
}Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
| Group: Expressions |
| Category: Required, Automated |
PQL Name: std.autosar_cpp14.A5_1_3 |
Version History
Introduced in R2019b