The name of the speaker is Mike Shaw and he is leading the Back to Basics session on functions at CPPcon.
The session is 60 minutes long and is intended for an introductory level. It is organized by Mike Shaw and Claus Ingberg as part of the Back to Basics and software development tracks.
The speaker, Mike Shaw, first learned about functions through a basic programming language called Dark Basic Pro, which he used to build games. He found a set of functions in the standard library that he could use to perform specific tasks, and this sparked his interest in the power of functions in programming.
At assembly lines 39 and 40, the arguments supplied to the function are being stored in registers, which can be thought of as variables in the assembly context.
The 'ad' function adds the two numbers passed as arguments and returns the result. It also sets up the return address and actual work of the function.
The 'pragma once' directive ensures that the header file, which contains declarations, is copied and pasted only once, preventing multiple duplication errors.
In C++, member functions are functions defined inside a class scope, which operate on the data members of the class. They are similar to methods in other object-oriented languages, but the terminology is more commonly used in C++. While some other languages might use the term 'methods' to refer to both class and object-level functions, in C++, member functions are typically referred to as 'member functions' when they are part of a class definition, and 'methods' when they are invoked on an object.
The virtual keyword in C++ is used to indicate that a member function can be overridden in derived classes. When a base class function is marked virtual, a virtual table (vtable) is created for each class or struct, which keeps track of the appropriate function implementation to call based on the actual object type. The override keyword is used in derived classes to explicitly indicate that a function is intended to override a virtual function from the base class. This helps ensure that the correct function is called at runtime and provides a way to implement polymorphism in C++.
constexpr is a keyword in C++ that suggests to the compiler that a function or variable can be evaluated at compile time. When a function is marked constexpr, the compiler can optimize the code by performing the computation during the compilation process, rather than at runtime. This can lead to performance improvements, as the computation is done once during the compilation and the result is embedded in the executable. Additionally, constexpr functions can help developers write more expressive and flexible code, as they can be used in contexts where only constant expressions are allowed, such as template arguments.
Function overloads
It is a rule that helps determine which function to call based on the types or scope of the arguments.
A functor is an object that overloads the function call operator () and can be used like a function, often used to keep track of state.