Hello all, for a long while i had used assembler and some C++ and had some questions.
When classes are made like:
myClass class;
Is this class created and put into the programs stack? Or within the actually executable?
If so, id assume static (if stack) makes it physically apart of the program. Are global variables apart of the executable and not the stack?
I assume, within functions if a variable is made, it is in the stack, if global then it must be apart of the program (when i wrote in assembler to try and mimic C++ this is what i had done) but static would make it Like a global variable being a part of the executable but only available to its scope (unlike a global variable)
Global variables are stored in a static region of memory. They take up space in the executable file, but in memory they usually cannot be stored with the code. Modern operating systems don't like pages to have both execute and write privileges. Static variables are identical to global variables except for scope and initialization rules.
Variables declared inside functions are put on the stack.. The program allocates stack space during the function call and calls their constructors at the lines where they are declared.