Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jul 2014 08:30:28 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        Ed Schouten <ed@80386.nl>, src-committers@freebsd.org, Ian Lepore <ian@freebsd.org>, svn-src-all@freebsd.org, Pietro Cerutti <gahr@freebsd.org>, svn-src-head@freebsd.org
Subject:   Re: svn commit: r268491 - head/usr.bin/users
Message-ID:  <A736379B-00CC-4D76-9937-7A666587C829@FreeBSD.org>
In-Reply-To: <201407111726.14347.jhb@freebsd.org>
References:  <201407101215.s6ACF3v1055260@svn.freebsd.org> <201407111003.57785.jhb@freebsd.org> <12328E44-58A8-4334-A7F4-C7F29C9F6D0E@FreeBSD.org> <201407111726.14347.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 11 Jul 2014, at 22:26, John Baldwin <jhb@FreeBSD.org> wrote:

>> For things that live in the base system, there's not much danger of boost conflicts.  'using namespace std' is mostly a problem when it's in headers (especially 
> library headers), because it can break large amounts of code.  In a tiny utility, it's probably the right thing to do.
> 
> The original question was about a general style rule for C++ code in FreeBSD.
> I suppose it would be fine to permit it in small utilities and only in .cc
> files but not otherwise?

I would say that it's completely fine as long as:

- It's in an implementation file and
- The utility has not dependencies other than the standard library

The first ensures that namespace pollution is localised.  The latter limits you to cases where there is no chance of there being any conflicts (if you're defining a symbol in a program that has the same name as an STL one then you should probably be referring to it by its fully qualified name anyway or the code will be unreadable).

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A736379B-00CC-4D76-9937-7A666587C829>