Something I realized about the standard namespace 06-15-2018, 12:23 AM
#1
Using the standard namespace can actually be bad practice because it can be referred to as "global namespace pollution". This means that you may run into problems whenever you have multiple namespaces that contain an identical function name with signature, so it would be kind of obscure for the compiler to be able to choose which one it would call, but this can be bypassed by designating the namespace with your function call, like this:
Or, if you don't want to type 'std::', then you can just do something like this:
Some of you may already knew this and these "problems" are pretty much an uncommon thing to come across in the first place, but I just thought I would share it with you guys.
Code:
std::coutOr, if you don't want to type 'std::', then you can just do something like this:
Code:
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
cout << "Hello, world!";
return 0;
}Some of you may already knew this and these "problems" are pretty much an uncommon thing to come across in the first place, but I just thought I would share it with you guys.
(This post was last modified: 11-01-2023, 06:47 AM by Confidential.)




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)

























