Are variables real things? [closed]

Variables are concepts in the C++ abstract machine that may or may not have a concrete counterpart in your computer. The not-so-closely guarded secret is that C++ abstract machines are not easy to come by (they’re abstract!), so instead we use some very smart tools, the compilers, to emulate the behaviour of a C++ abstract machine in your physical, concrete computer.

The compilers will try to map concepts in the C++ abstract machine to things that exist in your computer, but those mappings don’t have to be 100% exact. Compilers will often skip mapping some variables to anything at all, because they can make your program behave as if it was running in a C++ abstract machine without mapping them. This is just one of the many tricks that compilers will use to keep the illusion that your program is running in one of those abstract machines instead of your computer.

Does that mean the variables are “real”? That sounds just like an old question from philosophy: are numbers real?

Leave a Comment