I believe in least surprise for the caller of an API. This seems to match with the Google style, as you describe it: any parameter which may be mutated in any manner should be passed as pointer, rather than reference.
Cheers, David On 22/07/2019 08:43, Karl Tomlinson wrote: > https://google.github.io/styleguide/cppguide.html#Reference_Arguments > has a simple rule to determine when reference parameters are > permitted: > "Within function parameter lists all references must be const." > This is consistent with Mozilla's previous coding style: > "Use pointers, instead of references for function out parameters, > even for primitive types." [1] > However, across Gecko there are different interpretations of what > "out" parameter means. > > The Google style considers a parameter to be an out parameter if > any of its state may be mutated by the callee. > In some parts of Gecko, a parameter is considered an out parameter > only if the callee might make wholesale changes to the state of > parameter. Well before the announcement to switch to Google style, > this interpretation was discussed in 2017 [2], with subsequent > discussion around which types were suitable as non-const reference > parameters. > > I'm asking how should existing surrounding code with some > different conventions affect when is it acceptable to follow > Google style for reference or pointer parameters? > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform