Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!
Back to Basics: Functions
Monday, October 2 • 14:00 - 15:00
by Mike Shah
Summary of the talk:
Functions are one of the first things programmers learn, granting you the ultimate power to 'resuse' code and build modular programs. In this talk, we are going to provide an overview of functions from the start to the end, on the various powers that are given to us from the ground up. Consider this talk your one stop for learning all of the great things about functions!
We'll start with a basic function example, identifying the function signature and basic abilities of a function. Then we are going to view this function again from the perspective of assembly (using compiler explorer) to show you how a function is structured. From the assembly view, we will then observe that functions have addresses (they must after all!) and that we can store functions in pointers. We'll take a brief aside to show you how modern C++ also gives us the convenient std::function. Functions need not always be 'global' building blocks of our programs, the next step in our journey will be to see how we can have functions at local scope (e.g. lambda's) and how they can be used (and often times in handy ways in the STL). Ah, intrigued are you? We're not quite done! Now with building blocks such as lambda's (and related functors) we can utilize function composition to really unlock the power of functions. Towards the end of this talk, we will talk about grouping related functions (into namespaces) and as member functions in classes. Within our discussion of functions in classes, we'll touch on virtual functions, static functions, and operator overloading. We'll circle back to where we began on these topics, again showing you the assembly. At the end of this talk, you will have had FUN with functions (I couldn't resist...but you will see the complete C++ picture of functions).
Add a Comment
Comments are closed.