[Webkit-unassigned] [Bug 60638] check-webkit-style should warn about types we normally pass as reference

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 11 10:26:35 PDT 2011


Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
                 CC|                            |andersca at apple.com

--- Comment #1 from Darin Adler <darin at apple.com>  2011-05-11 10:26:34 PST ---
Despite the fact that I think this is probably a good guideline, there are at least two possible benefits to passing a type like IntPoint by value instead of by reference.

First, Anders Carlsson has claimed that in some situations on some platforms it may be more efficient. He can fill in the details at some point when he has the chance.

Second, if you pass a point by reference, you can run into cases where reentrancy can change the value.

Here's an example:


    inside the scrollTo function

    FrameView::scrollTo(const IntPoint& position)
        ... position has the value passed in ...
        ... do some work that changes the document size ...
        ... position is now the new document size ...

This can mean that if you, say, check for a special value such as zero, the value can change later in the same function.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list