Back to the basics: Namespaces 101
summary
Covers concrete rules and gotchas: the compiler’s qualified vs unqualified lookup order, how argument dependent lookup (ADL) pulls functions from argument namespaces, and when inline namespaces for versioning actually expose a version as the default. Shows examples where using directives break builds (std::sqrt shadowing), recommends using declarations only in .cpp, anonymous namespaces for translation-unit privacy, avoid using directives in headers, prefer aliases and fully qualify macros, and limit nesting to about four levels.
AI-written summary · about
chapters (8)
- 0:00Namespaces introduction
- 2:11What namespaces solve
- 4:02C++ standards evolution
- 10:13Namespace mechanics
- 21:20Namespace scope rules
- 36:26Best practices
- 58:38Industry vs guidelines
- 59:43Key takeaways
related talks
01h 02mBack to Basics: Function Call Resolution in C++
01h 02mBack to Basics: Designing Classes (part 2 of 2)
04mCalling code w/o headers...
01h 00mBack to Basics: (Range) Algorithms in C++
05mLightning Talk: Effective APIs in Practice in C++
01h 01mBack to Basics: Designing Classes (part 1 of 2)
01h 02mBack to Basics: Initialization in C++
01h 00mBack to Basics: Object-Oriented Programming
