Why use std::

Apr 13, 2019 at 2:58pm
Why do some people use std:: when you can use "using namespace std " ?

1
2
ng
  Put the code you need help with here.
ng
Apr 13, 2019 at 3:03pm
closed account (1vf9z8AR)
There is a good article on it on stack overflow
https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice

Although if you are doing coding for school or college don't bother using std again and again.

Just use "using namespace std;"
Last edited on Apr 13, 2019 at 3:05pm
Apr 13, 2019 at 4:33pm
the 10 cent summary of the article is that std:: is huge beyond control and it is too easy to accidentally reuse common words that it defines, causing problems, eg min and max and many other common variable name candidates are defined in it.

you can use bits of it, eg using std::cout
Last edited on Apr 13, 2019 at 4:34pm
Topic archived. No new replies allowed.