Namespaces 101

Sandor DARGO

⏱ 75 mins
beginner
11:00-12:15, Monday, 23rd June 2025

In this beginner-friendly talk, we are going to explore namespaces. They are an essential tool for organizing our codebase around different concerns and across different layers. But we cannot call it a day by simply stating that.

We also need to discuss their evolution. Over time, C++ introduced features like inline namespaces, which are a handy tool for API versioning. Additionally, namespace usage has been simplified—nested namespaces and even nested inline namespaces can now be opened directly.

After covering the syntactic basics, we will dive into how the compiler performs name lookup. Which namespaces will it check from a given scope? And if it cannot find a symbol, how can we bring in all or specific members of a namespace into our current scope? What advantages anonymous namespaces offer?

In the final section of our talk, we'll move beyond language rules to cover best practices based on the Core Guidelines, the Google Style Guide, and personal experience. This includes not just naming and formatting conventions, but also guidance on how and when to bring the contents of a namespace into a scope—and the potential pitfalls of the using keyword for your codebase.


🏷 basics

Sandor DARGO

Sandor is a passionate software craftsman focusing on reducing the maintenance costs by developing, applying and enforcing clean code standards. His other core activity is knowledge sharing both oral and written, within and outside of his employer. When not reading or writing, he spends most of his free time with his two children and his wife baking at home or travelling to new places.