Timeline for Use `using` in C++ or avoid it?
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 3, 2012 at 15:02 | comment | added | Tamás Szelei | While C++ indeed does allow one to declare types on the function level, it is not a common thing; other than that, the possible name clashes are easy to spot from the compiler output (but you are right that this does not prevent them). | |
| Aug 3, 2012 at 12:47 | comment | added | Michael Kohne | @fish - actually, doing 'using namespace' in function scope doesn't avoid the issue, it just limits the space where things can go wrong. And if you end up putting 'using namespace' in every function, it's not much different from just doing it globally. | |
| Aug 3, 2012 at 11:58 | comment | added | Tamás Szelei | Alternatively, you can using namespace just in a function scope, avoiding the issue. | |
| Aug 3, 2012 at 11:12 | history | answered | Michael Kohne | CC BY-SA 3.0 |