Goroutines and channels

One of Go’s initial design requirements was to make it easy to create multi-threaded applications. While many languages support multi-threading, it’s not always easy to implement. Go wanted to make it easy to do this. Consider the following code where it runs sequentially. If you run this, every function call to PrintHello() has to complete…

Inline Functions in C++

Calling a function has a performance penalty because you have to create variables, specify scope, pause the current variables and push data onto the call stack, just to name a few reasons. C++ allows you to define an inline function, which should be short, to improve the performance. In doing so, the compiler will actually…

Default Arguments

C++ has added the ability to have default arguments be defined when you declare your functions. To define a default value, you must specify the parameter name, and then assign it a value. If someone calls this function without passing an argument to the function, the computer will use 20 as the parameter. If they…

Overloading a Function

Overloading a function means that you can create different functions with the same name, as long as their signatures are different. That means that the parameter list must be of a different number and/or data types from one to another. Overloading functions can make reading code much clearer/easier. This way functions that perform the same…