[webkit-dev] Using namespace std

Peter Kasting pkasting at chromium.org
Tue May 15 11:46:09 PDT 2012


On Tue, May 15, 2012 at 11:37 AM, Ryosuke Niwa <rniwa at webkit.org> wrote:

> On May 15, 2012 10:53 AM, "Peter Kasting" <pkasting at chromium.org> wrote:
> > Given how little of std:: we actually use (since WTF is used instead for
> most things), what about just explicitly qualifying usages with std::
> directly?
>
> Can we do that if and only if we have conflicts?
>
Well, I guess we can do anything we want :).  It might be nice to have a
consistent rule though (much like the current style rule is consistent, if
sometimes problematic).

An alternative solution is to forward conflicting symbols from std to WTF
> (i.e. make decisions about namespace in WTF) so that the rest of codebase
> can simply use the forwarded WTF symbols instead. We could even wrap
> whatever function we're using with a different name if we wanted.
>
>From the bugs linked in the root post of this thread, it looks like the
common offenders are std::min(), std::max(), and std::numeric_limits, with
a guest appearance by std::make_pair().  It seems like either solution
above -- explicitly qualifying usages of these, or forwarding them through
WTF -- would probably work.  One factor that makes me still favor the
explicit qualification is that I've been burned enough by various
compilers/environments defining "min" and "max" that anything that results
in pulling those symbols into the global scope makes me anxious.

PK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120515/82bdf680/attachment.html>


More information about the webkit-dev mailing list