I could grudgingly get on board with that, though I feel that there are sort of two levels of mutability I use: casual and essential. Essential is protected by constness, whereas casual is sort of everyday minor changes, but changes I don't want to allow in `const` code, thus don't want `mutable`. It's subjective, but has been useful to handle mutability trade-offs. (since we don't have multiple constnesses, Views and factories are sometimes alternatives)
I really really like the non-null annotation reference provides, since pointers (especially in headers without diving into source code) are ambiguously nullable. On Mon, Jul 22, 2019 at 7:29 AM David Teller <dtel...@mozilla.com> wrote: > > 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 _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform