[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#165515: FTBFS: Apply 'using namespace std' liberally



Joel/others,

On Sat, Oct 19, 2002 at 10:05:25PM -0600, fenton@debian.org wrote:
> APT often uses things from the 'std' namespace, without declaring itself
> to do so. On newer GCC variants, this causes build failures; even on
> older ones, it should be safe to explicitly declare that one is using the
> namespace.

In .cc files, this is fine, however you shouldn't use "using" in public
header files as it pollutes the name space. For example, someone might
want to declare

typedef basic_string<char,std::char_traits<char>,my_allocator<char> > string;

in order to use his own memory allocator for his strings. If some header
file declares to use the entire std namespace, then suddenly there is a
conflict. IMO it is better to write fully qualified names in the .h
files.

   Simon

-- 
GPG Fingerprint: 040E B5F7 84F1 4FBC CEAD  ADC6 18A0 CC8D 5706 A4B4

Attachment: pgpw_y_kQ0_px.pgp
Description: PGP signature


Reply to: