[webkit-dev] Using namespace std
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::
> 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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev