Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #7341

Re: Using "using" and namespace pollution from header files

From RaZiel <raziel_206_@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Using "using" and namespace pollution from header files
Date 2011-07-02 03:25 +0200
Organization Aioe.org NNTP Server
Message-ID <iuls2e$tt5$1@speranza.aioe.org> (permalink)
References <ygf8vsj7gqy.fsf@janus.isnogud.escape.de> <4e0c5756$0$2818$7b1e8fa0@news.nbl.fi>

Show all headers | View raw


On 30.06.2011 13:00, Juha Nieminen wrote:
> Urs Thuermann<urs@isnogud.escape.de>  wrote:
>> What is current or wide-spread best-practice?
>
>    The most common coding guideline is that the 'using' keyword should
> never be used in a header file.
>
>    (Ok, the 'using' keyword has another role besides dealing with namespaces.
> There are certain situations where you have to tell in a derived class that
> a function in the base class should be visible in the derived class, but
> that has nothing to do with namespaces. The guideline is only about bringing
> names from namespaces to other namespaces.)
>
>    Personally I follow the rule "never use 'using'" (except in those rare
> cases where its role has nothing to do with namespaces, of course). I find
> that the code becomes more readable and easier to understand with the
> namespace prefixes than without them. For some strange reason most people
> seem to think the opposite. I don't understand that.

I agree with your last paragraph, but only when the length of the 
namespace prefixes is within a reasonable length.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Using "using" and namespace pollution from header files Urs Thuermann <urs@isnogud.escape.de> - 2011-06-30 12:31 +0200
  Re: Using "using" and namespace pollution from header files Juha Nieminen <nospam@thanks.invalid> - 2011-06-30 11:00 +0000
    Re: Using "using" and namespace pollution from header files RaZiel <raziel_206_@hotmail.com> - 2011-07-02 03:25 +0200
    Re: Using "using" and namespace pollution from header files SG <s.gesemann@gmail.com> - 2011-07-01 18:48 -0700

csiph-web