We talk about methods in this episode. There’re many kinds of methods and we’ll need to split this topic into multiple episodes. I’ll explain how methods are called and how they return when they’re done. And a bit about how viruses can sneak in and gain control.

It doesn’t matter what language you’re using, there will be methods involved at some level. Methods allow you to wrap up a bunch of instructions so you can call on them whenever you need. But what does this mean? How can you just call something? It’s not like you’re ringing a dinner bell and your instructions come running towards you.

You’ll learn about two very important registers inside a microprocessor called the instruction pointer and the stack pointer. I explain how the instruction pointer gets updated and always points to the next instruction in line to be executed. And how the stack is a section of memory that helps coordinate methods with the help of the stack pointer.

A modern processor has support to help eliminate the threat of viruses of the type I talked about but it’s a constant struggle to keep up. Learning about how methods work, how the compiler prepares to make a method call, how the processor transfers control to the method, and then how the method returns are critical to understanding how your code behaves and how to keep it secure.