Number of function arguments
ID | FCNS-2 |
Title | Limit the number of inputs and outputs of a function. |
Priority | Recommended |
Severity level | 8 |
Description | Limit the number of inputs and outputs of a function to five. If necessary, combine multiple arguments into a struct. |
Rationale | This helps prevent a long calling syntax, which in turn improves the readability and reusability of the code. |
Avoid:
out = computeWeight(blockHeight, blockWidth, blockDepth, density, nBlocks, idx);
Instead use:
out = computeWeight(blockData, nBlocks, idx);