Timeline for Are namespace constructs like 'using std::string' unacceptable also in .cpp files?
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 22, 2020 at 9:36 | history | edited | user377672 | CC BY-SA 4.0 |
edited body
|
| Oct 22, 2020 at 9:26 | comment | added | user377672 |
@rwong From my standpoint, using namespace std; int main() {cout << "hello, world\n;}" is more explicit, not less, than int main() {std::cout << "hello, world\n";}, because the latter version requires implicitly relying on ADL to find operator<< in namespace std.
|
|
| Oct 22, 2020 at 9:22 | comment | added | user377672 |
@rwong I've seen people radically change styles overnight like (2==x) over (x==2) for expressions I've always been a bit more stubborn than that, favoring whatever seems idiomatic when possible and "natural" until I can't make a good argument for it anymore. But the namespace and ADL issues were enough after multiple bugs, not one, for me to favor using directives and declarations. I don't think we can avoid being implicit here. I might even push that using directives/declarations are more explicit because of the existence of ADL/Koenig Lookup.
|
|
| Oct 22, 2020 at 9:11 | comment | added | rwong | C++ programmers (like myself) seem to be particularly motivated by a single yet memorable bad experience such as obscure source-level bugs. C++ forces programmers to be as explicit (ambiguity-removing) as possible. | |
| Oct 22, 2020 at 3:29 | history | edited | user377672 | CC BY-SA 4.0 |
added 4 characters in body
|
| Oct 22, 2020 at 3:22 | history | answered | user377672 | CC BY-SA 4.0 |