[webkit-dev] Lets use PassRefPtr for arguments less; lets use RefPtr for locals and data members more
ap at webkit.org
Mon Jun 20 18:11:18 PDT 2011
20.06.2011, в 17:25, Maciej Stachowiak написал(а):
>> Yet it's the latter where PassRefPtr is beneficial. Why base the rule on something that's disconnected from actual benefit?
> Because it's simpler to read the source of your own function than to visit all call sites, and it's more obvious that when you change what the function does you may need to change the signature.
I do not see how you are describing a practical coding situation here. I do not start with a dozen call sites all over the code base, and then write a function they all call. On the other hand, when adding a new call site that wants to pass ownership away, and the called function doesn't take a PassRefPtr, it's immediately obvious that it's not going to work.
Even when following a cargo cult rule is easier (not uncommon!), the problem of it being disconnected from the actual benefit still remains.
- WBR, Alexey Proskuryakov
More information about the webkit-dev