Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
FYI, a patch has been posted to https://bugs.webkit.org/show_bug.cgi?id=69766 to make this change along with get prefix convention for getters that return values via out arguments. - Ryosuke On Tue, Oct 4, 2011 at 2:06 PM, Ryosuke Niwa rn...@webkit.org wrote: Hi, It came to my attention that some people are using raw pointers to pass out-arguments (e.g. bug 69366). In my understanding, we use pass by reference for out arguments when they have to be modified in callees. If there's no objection, I'm going to file a bug upload a patch to state this explicitly in the style guideline. Best, Ryosuke Niwa Software Engineer Google Inc. ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
It feels like the material about RefPtr belongs here: http://www.webkit.org/coding/RefPtr.html instead of the style guide since that is where everything else about how to properly use RefPtr/PassRefPtr is. On Mon, Oct 10, 2011 at 10:42 AM, Ryosuke Niwa rn...@webkit.org wrote: FYI, a patch has been posted to https://bugs.webkit.org/show_bug.cgi?id=69766 to make this change along with get prefix convention for getters that return values via out arguments. - Ryosuke On Tue, Oct 4, 2011 at 2:06 PM, Ryosuke Niwa rn...@webkit.org wrote: Hi, It came to my attention that some people are using raw pointers to pass out-arguments (e.g. bug 69366). In my understanding, we use pass by reference for out arguments when they have to be modified in callees. If there's no objection, I'm going to file a bug upload a patch to state this explicitly in the style guideline. Best, Ryosuke Niwa Software Engineer Google Inc. ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
This is nothing to do with RefPtr. - Ryosuke On Mon, Oct 10, 2011 at 10:56 AM, David Levin le...@chromium.org wrote: It feels like the material about RefPtr belongs here: http://www.webkit.org/coding/RefPtr.html instead of the style guide since that is where everything else about how to properly use RefPtr/PassRefPtr is. On Mon, Oct 10, 2011 at 10:42 AM, Ryosuke Niwa rn...@webkit.org wrote: FYI, a patch has been posted to https://bugs.webkit.org/show_bug.cgi?id=69766 to make this change along with get prefix convention for getters that return values via out arguments. - Ryosuke On Tue, Oct 4, 2011 at 2:06 PM, Ryosuke Niwa rn...@webkit.org wrote: Hi, It came to my attention that some people are using raw pointers to pass out-arguments (e.g. bug 69366). In my understanding, we use pass by reference for out arguments when they have to be modified in callees. If there's no objection, I'm going to file a bug upload a patch to state this explicitly in the style guideline. Best, Ryosuke Niwa Software Engineer Google Inc. ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
On Tue, Oct 4, 2011 at 2:06 PM, Ryosuke Niwa rn...@webkit.org wrote: In my understanding, we use pass by reference for out arguments when they have to be modified in callees. I had not heard this. Personally I weakly prefer pointers to non-const refs for outparams, but if there is convention the other way that's fine. PK ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
On Tue, Oct 4, 2011 at 2:11 PM, Peter Kasting pkast...@chromium.org wrote: On Tue, Oct 4, 2011 at 2:06 PM, Ryosuke Niwa rn...@webkit.org wrote: In my understanding, we use pass by reference for out arguments when they have to be modified in callees. I had not heard this. As far as I know, this is the convention used in the majority of WebCore. - Ryosuke ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
On Tue, Oct 4, 2011 at 2:06 PM, Ryosuke Niwa rn...@webkit.org wrote: Hi, It came to my attention that some people are using raw pointers to pass out-arguments (e.g. bug 69366). In my understanding, we use pass by reference for out arguments when they have to be modified in callees. If there's no objection, I'm going to file a bug upload a patch to state this explicitly in the style guideline. Could you explain why? Is it to document the nullity of the out-param? 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. - James Best, Ryosuke Niwa Software Engineer Google Inc. ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
On Oct 4, 2011, at 2:06 PM, Ryosuke Niwa wrote: It came to my attention that some people are using raw pointers to pass out-arguments (e.g. bug 69366). In my understanding, we use pass by reference for out arguments when they have to be modified in callees. If there's no objection, I'm going to file a bug upload a patch to state this explicitly in the style guideline. If it’s not already in there, I think you might also want to mention the related rule that encourages the use of the word “get” at the starts of the names of these functions with out arguments. -- Darin ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
Interesting. I thought historical policy was universally against the word get in function names. I guess you're suggesting that get should only be applied to function names which have an out-argument? -eric On Tue, Oct 4, 2011 at 6:00 PM, Darin Adler da...@apple.com wrote: On Oct 4, 2011, at 2:06 PM, Ryosuke Niwa wrote: It came to my attention that some people are using raw pointers to pass out-arguments (e.g. bug 69366). In my understanding, we use pass by reference for out arguments when they have to be modified in callees. If there's no objection, I'm going to file a bug upload a patch to state this explicitly in the style guideline. If it’s not already in there, I think you might also want to mention the related rule that encourages the use of the word “get” at the starts of the names of these functions with out arguments. -- Darin ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
At least we already have some of such mehods like: void Range::getBorderAndTextQuads(VectorFloatQuad) const; void VisiblePosition::getInlineBoxAndOffset(InlineBox* inlineBox, int caretOffset) const; void Posiiton::getInlineBoxAndOffset(EAffinity, InlineBox*, int caretOffset) const; void FrameView::getTickmarks(VectorLayoutRect) const; bool Editor::getCompositionSelection(unsigned selectionStart, unsigned selectionEnd) const; On Wed, Oct 5, 2011 at 10:14 AM, Eric Seidel e...@webkit.org wrote: Interesting. I thought historical policy was universally against the word get in function names. I guess you're suggesting that get should only be applied to function names which have an out-argument? I once heard such a feed back on some review. And at least we already have some of such mehods like: void Range::getBorderAndTextQuads(VectorFloatQuad) const; void VisiblePosition::getInlineBoxAndOffset(InlineBox* inlineBox, int caretOffset) const; void Posiiton::getInlineBoxAndOffset(EAffinity, InlineBox*, int caretOffset) const; void FrameView::getTickmarks(VectorLayoutRect) const; bool Editor::getCompositionSelection(unsigned selectionStart, unsigned selectionEnd) const; ...and more: http://codesearch.google.com/codesearch#search/exact_package=chromiumq=WebCore%20get.%2B%20file:h$ Personally prefer the get prefix for function with out-params since it's hard to feel it like an attribute/member variable. This is never a strong claim though. Regards, -- morrita -eric On Tue, Oct 4, 2011 at 6:00 PM, Darin Adler da...@apple.com wrote: On Oct 4, 2011, at 2:06 PM, Ryosuke Niwa wrote: It came to my attention that some people are using raw pointers to pass out-arguments (e.g. bug 69366). In my understanding, we use pass by reference for out arguments when they have to be modified in callees. If there's no objection, I'm going to file a bug upload a patch to state this explicitly in the style guideline. If it’s not already in there, I think you might also want to mention the related rule that encourages the use of the word “get” at the starts of the names of these functions with out arguments. -- Darin ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev -- morrita ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
On Tue, Oct 4, 2011 at 2:14 PM, James Robinson jam...@google.com wrote: Is it to document the nullity of the out-param? Yes, and it also prevents mistakes like: #include cstdio class base { ... }; class derived : public base { ... }; void getBase(base* b) { *b = base(); } int main() { derived d; getBase(d); return 0; } - Ryosuke ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Change to style guideline: should use type instead of type* for out arguments
On Oct 4, 2011, at 6:14 PM, Eric Seidel wrote: I thought historical policy was universally against the word get in function names. The policy has been to reserve the word get to mean a function that gets a value in an out argument, as opposed to a function that returns a value, which we instead name with a noun or adjective describing the value. I guess you're suggesting that get should only be applied to function names which have an out-argument? Right, that’s what we’ve been doing. But I see now that the rule is not as well known as I thought. -- Darin ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev