+ 6
Cpp Question 😎
Why do we use the 'std::cout' when can use only cout <<?
8 Respuestas
+ 6
This one got some attention in the answers:
https://www.sololearn.com/Discuss/1004636/?ref=app
+ 6
Since the introduction of using namespace std, there have been arguments about whether it is a good or bad thing. I don't like it because it puts tons of symbol names into your global scope. These names are so numerous that it is likely you don't know them all. You could plan on overloading one of the names and forget to declare it. Now you end up sharing the standard one with random side effects.
+ 4
This is will tell you about std:: and using namespace std;
https://www.sololearn.com/Discuss/294730/?ref=app
Example code without using namespaces
https://code.sololearn.com/cUx55EsTKnaz/?ref=app
+ 2
You can only use cout by itself if you have added a using statement for the std namespace. Otherwise you'd receive an error.
+ 2
John Wells I was very recently digging into gcc and found files like these:
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/c_compatibility/stdio.h
...so when I #include <stdio.h> I think I get this file, which is basically ~50 lines that read:
using std::keyword; // times 50
...is this an easy example of the globals issue?
+ 1
Eric Lecorps are you brother of Jayden Lecorps
0
That file is meant to be used in C code, where there you automatically get all the names in global scope for the files you include.
0
hello Eric what programming language are u learning