[webkit-dev] String::operator+= considered harmful

Anders Carlsson andersca at apple.com
Fri Sep 7 17:10:48 PDT 2012


On Sep 4, 2012, at 5:52 PM, Benjamin Poulain <benjamin at webkit.org> wrote:

> On Tue, Sep 4, 2012 at 4:22 PM, Adam Barth <abarth at webkit.org> wrote:
> Removing operator+= will likely require changes to a number of
> port-specific files.  I'll do my best to remove these, but I might
> need some help from maintainers of individual ports.  If you're
> interested in helping out, please let me know.
> 
> You did an amazing work cleaning WebKit. I'll help on you finish on the Mac port. I will look at that today.
> 
> > If operator+= cannot be made sufficiently efficient, we could always leave the operator there, but have it ASSERT with a message saying to use StringBuilder.
> 
> That's a nice idea with a compile-time failure. It would be a new error-based documentation system :)

You could just keep the operator+= declaration, but omit the definition (and explicitly mark it deleted when building with a compiler that supports that part of the C++11 spec).

- Anders

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120907/da3fc8d6/attachment.html>


More information about the webkit-dev mailing list