File: README-function-args-by-value.md

package info (click to toggle)
clazy 1.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,384 kB
  • sloc: cpp: 24,969; python: 1,429; xml: 448; sh: 237; makefile: 48
file content (10 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
# function-args-by-value

Warns when you should be passing by value instead of by-ref.
Types with sizeof <= 16 bytes [1] which are trivially-copyable [2] and trivially-destructible [3] should be passed by value.

Only fix these warnings if you're sure that the value would be passed in a CPU register instead on the stack.

- [1] <http://www.macieira.org/blog/2012/02/the-value-of-passing-by-value/>
- [2] <http://en.cppreference.com/w/cpp/concept/TriviallyCopyable>
- [3] <http://www.cplusplus.com/reference/type_traits/is_trivially_destructible/>