string reverse

Pages: 12
Oct 2, 2014 at 11:07am
it could be a problem for multiple namespaces.
beginners who use only std; need not jumble up their head with multiple "std::x"
however, thanks for informing.
Last edited on Oct 2, 2014 at 11:09am
Oct 2, 2014 at 11:17am
The second link shows problem with single namespace.

Good habits should be developed early. It is hard to break bad habits. In this very forum sometimes you can see threads from beginners who decided to make a game and encountered a name clash with library they chose.
Its use is fine in examples, but in code you write you should not use it. The whole using namespace is introduced for backward compatibility with really old code.
Oct 2, 2014 at 6:15pm
guys like you making C++ harder (゜_゜)
for my namespaces, all elements can begin with specific prefix - avoiding conflict with other namespace, and easy understandability - similar to using 'p' prefix for all pointers.

"I usually leave out the std:: when discussing standard features;"
- page39, The C++ Programming Language, 4th ed. (2013) - Bjarne Stroustrup"


"By putting my code into the namespace My_code, I make sure that my names do not conflict with the standard-library names in namespace std"
- page54, The C++ Programming Language, 4th ed. (2013) - Bjarne Stroustrup
Oct 2, 2014 at 6:48pm
guys like you making C++ harder (゜_゜)


If by harder you mean actually learning to do it correctly then yes. Sure it is sometimes easier to learn how to code and actually code by using bad practices but that doesn't mean it is right to do so.

As he pointed out before learning good practices and habits from the start is much easier then having to unlearn them later (And trust me if you plan on doing anything beyond toy projects you will need to unlearn them).

"I usually leave out the std:: when discussing standard features;"
- page39, The C++ Programming Language, 4th ed. (2013) - Bjarne Stroustrup"


Discussing standard features and actually learning about C++ or helping someone learn about C++ is completely different things.

for my namespaces, all elements can begin with specific prefix - avoiding conflict with other namespace, and easy understandability - similar to using 'p' prefix for all pointers.

If what you mean is something like SomeDataType* pSomething; or SomeDataType w_Something;

It still does not guarantee no name clashes will happen and this is the exact thing that namespaces were made to replace.
Last edited on Oct 2, 2014 at 6:55pm
Topic archived. No new replies allowed.
Pages: 12