[webkit-dev] Using namespace std

Peter Kasting pkasting at chromium.org
Tue May 15 10:52:52 PDT 2012


On Tue, May 15, 2012 at 9:31 AM, Darin Adler <darin at apple.com> wrote:

> On May 15, 2012, at 5:48 AM, Allan Sandfeld Jensen wrote:
>
> > To me it seems like an odd practice, so I would like to ask what
> original rationale behind that style guideline is
>
> Adding a list of using declarations like "using std::min" to the top of
> each source file would give us another ongoing maintenance job. The list in
> each file would grow, we’d not remember to remove them when they are no
> longer needed, and so on.


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?  I realize you probably feel like these sorts of qualifications
make code less readable, but the impact of that seems minor to me -- the
Chromium codebase gets away with doing it and uses std:: far more often
than WebKit -- and it avoids the sort of maintenance headaches you mention.
 It also makes it clearer to a reader when we are actually pulling in types
or functions from std:: (which might not always be what we wanted), and
avoids any naming conflicts from pulling in the whole std:: namespace
(which is apparently the reason for this thread).

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


More information about the webkit-dev mailing list