[webkit-dev] Add explicit style guideline: should use type& instead of type* for out arguments

Ryosuke Niwa rniwa at webkit.org
Tue Oct 4 19:21:35 PDT 2011


On Oct 4, 2011 5:57 PM, "Darin Adler" <darin at apple.com> wrote:
> > I personally find pointers for out parameters to be appropriate in many
situations. It makes the side effects of manipulating the parameter more
obvious, and it provides a clear way for the caller to indicate that they
don't care about a certain out parameter. It sounds like you have reasons to
prefer the opposite behavior.
>
> For an optional out parameter, our style has been to use a pointer. For a
non-optional, our style has been to use a reference.

In addition, I normally prefer to have two overloaded inline functions to
wrap the optional argunents in such cases to avoid callers from using raw
pointers.

> There are hundreds of these in WebCore and JavaScriptCore. It’s largely an
arbitrary guideline, but one that has been around for years and I’d prefer
not to change style unless there is a strong reason.

Right. That's the motivation behind my proposal.

- Ryosuke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20111004/5f0d45f3/attachment.html>


More information about the webkit-dev mailing list