Sign up for the KDAB Newsletter
Stay on top of the latest news, publications, events and more.
Go to Sign-up


Find what you need - explore our website and developer resources
23 April 2026
I often put my helper functions into my C++ files rather than having them as private member functions. Is that a good idea?
Get the full answer from Peppe, who will take it much further than just a yes/no answer.
Among other things, he will argue why you should even have anonymous namespace and static keyword for such functions
Towards the end he will also show you a rather interesting bug, which you will be faced with, if you do NOT put classes declared in cpp files into anonymous namespaces.
Links:
Chapters:
00:00 Welcome
00:44 Anonymous namespaces
01:40 Static keyword
02:45 Static + anonymous namespace
04:47 Advertise: Rust training
04:55 Should I put all off my private functions into anonymous namespaces
06:32 Private is an implementation detail
08:41 Private functions can access the object, free functions can't
10:05 The pimp pattern
11:20 What is the cost to the pimpl pointer?
13:05 How about my small helper functions - should I make them static?
14:00 Lambda expression
15:27 A function returning a lamda
15:53 Example of a class in anonymous namespace
22:28 So, what is going on here?
25:50 The proxy class
Stay on top of the latest news, publications, events and more.
Go to Sign-up
Learn Modern C++
Our hands-on Modern C++ training courses are designed to quickly familiarize newcomers with the language. They also update professional C++ developers on the latest changes in the language and standard library introduced in recent C++ editions.
Learn more