Everything about development and the OpenMW source code.
User avatar
Site Admin
Posts: 1143
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Github profile:


Post by lgromanowski » 13 Aug 2011, 21:42

Zini wrote: I just noticed, that I haven't written much about namespace using in our Policies and Standards page: ... _Standards

Not using using declarations and directives in headers to open up namespaces should be obvious for an experienced C++ coder. But there is still the issue of the implementation files (cpp).

The majority of the code is not using using directives. Some parts do so extensively. Personally I consider dumping a whole namespace into another namespace via a using directive very bad coding style. But I recognise that this topic is somewhat controversial.

Therefore I would like to ask if I can expect a violent outcry, if i codify the following rules in the wiki:

- Opening a namespace via a using directive (e.g. using namespace std) should be avoided complete.
- Opening a part of a namespace via a using declaration (e.g. using std::cout) is acceptable (but not mandatory and not encouraged either) and should be used as local as possible (e.g. function scope).

For a more in deep discussion of this topic, see this link: ... l#faq-27.5
Star-Demon wrote: I like the second one - I clearly know which namespace I'm using for that particular operation and I don't have to worry about which namespace I'm in elsewhere in code. This lets me focus on the namespace of my class at a higher level of abstraction.

I say eat it and use std::foo. If you're coding in bash or pico, tough luck - get a copy and paste function, and while you're at it, get both HOME and END to work.
best regards,


Who is online

Users browsing this forum: No registered users and 1 guest