Loading…
View analytic
Friday, September 29 • 10:30am - 11:00am
What C++ developers should know about globals (and the linker)

Log in to save this to your schedule and see who's attending!

Most C++ developers know that using globals (or singletons) excessively in code is usually a poor decision. But it is also hard to deny their usefulness in more than one situation: for loggers, factories, intrusive performance benchmarking, and other very useful applications, globals can be very helpful.

Unfortunately, usage of globals in C++ ends up exposing details of the language not seen so often otherwise. Instead of dealing with our tried-and-true, well specified compiler, we often need to look more at the behavior of the linker, which can vary more between platforms and between different options such as static vs dynamic linking.

This talk will look at some surprising pitfalls that can occur with globals: valid programs only a dozen lines long that can trigger segfaults when using the gcc linker. It will explore some of these issues using command line tools like nm and objdump. The talk will enumerate several pitfalls to be avoided. It will look at some of the different axes of the problem space such as: globals that are private versus public, eager versus lazy, global inter-dependencies, and quality of emitted assembly. Finally, solutions and idioms will be presented that address the major use cases, and make it easy for developers to use globals (only where necessary!) in a safe way.


Speakers
NF

Nir Friedman

Trading Software Developer, Tower Research Capital
After completing a PhD in physics, Nir started working doing C++ in low latency and high frequency trading. He's interested in the challenges of writing robust code at scale, and highly configurable code that minimizes performance trade-offs.


Friday September 29, 2017 10:30am - 11:00am
Meydenbauer TBA #3 Meydenbauer Center
Feedback form isn't open yet.