Our conventions at work are pretty simple:
- Value when copies are cheap (mostly meaning intrinsic 32 or 64 bit types)
- Const reference when copies are not cheap
- Const pointer when optional (exception for const char*)
- Pointer when mutable by the function itself
- Conformant array for any buffer with a known size (optionally const), where the size is passed as an additional parameter
I like it.
My own style in personal projects generally uses references over pointers for mutables, but that's just a quirk. I also tend to prefer container classes to raw arrays, so I don't use the conformant array syntax. So on a few subtle points I don't think there's really a right or wrong answer, but there
are some fundamentals to keep in mind:
- Don't copy unless you need copy semantics (or if you're passing a small intrinsic type)
- Be const-correct
- Try to make it easy to tell what a function will do with a parameter just by reading its signature
IMHO if you can hit all three points, any style is legit.