[webkit-reviews] review denied: [Bug 101861] Check for assignment to self in WTF containers' operator=() : [Attachment 173506] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Nov 11 09:33:57 PST 2012


Maciej Stachowiak <mjs at apple.com> has denied Christophe Dumez
<christophe.dumez at intel.com>'s request for review:
Bug 101861: Check for assignment to self in WTF containers' operator=()
https://bugs.webkit.org/show_bug.cgi?id=101861

Attachment 173506: Patch
https://bugs.webkit.org/attachment.cgi?id=173506&action=review

------- Additional Comments from Maciej Stachowiak <mjs at apple.com>
The best way to make an assignment operator that is safe against
self-assignment is to use the copy-and-swap idiom:
http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Copy-and-swap

In fact, it looks like many of these classes already use the copy-and-swap
idiom, which makes this change unnecessary for correctness. At best it would
matter for efficiency. But we should not make changes solely for performance
without some evidence that they help performance.

Therefore please provide evidence that explicit self-assignment checks give a
performance benefit.


More information about the webkit-reviews mailing list