CSC258H5 Lecture Notes - Lecture 11: Journal Of Forestry
Document Summary
Note: if we have multiple levels of function calls, the return address should be stored on the stack, so you don"t overwrite the value of the first function call. So before making a function call, you have to store all temporary values and return values on to the stack before calling the function. This way, you will not lose those values. When you return from a function call, pop the values from the stack. Notice that this increases the time cost. Inline functions are faster because the then you do not need to do jumps or stack manipulations. This code avoids the if branching statement so you can avoid jumping and branching. Modern processesor tries to load the next instruction, which gives a speed boost, but if you branch to a different line, then the speed boast is waster.