Beginner assembly programming memory usage question

Posted by Daniel on Stack Overflow See other posts from Stack Overflow or by Daniel
Published on 2010-03-22T06:08:22Z Indexed on 2010/03/22 6:11 UTC
Read the original article Hit count: 250

Filed under:
|
|

I've been getting into some assembly lately and its fun as it challenges everything i have learned. I was wondering if i could ask a few questions

  1. When running an executable, does the entire executable get loaded into memory?

  2. From a bit of fiddling i've found that constants aren't really constants? Is it just a compiler thing?

const int i = 5;

_asm { mov i, 0 } // i is now 0 and compiles fine

So are all variables assigned with a constant value embedded into the file as well? Meaning:

int a = 1;

const int b = 2;

void something() { const int c = 3; int d = 4; }

Will i find all of these variables embedded in the file (in a hex editor or something)?

  1. If the executable is loaded into memory then "constants" are technically using memory? I've read around on the net people saying that constants don't use memory, is this true?

© Stack Overflow or respective owner

Related posts about assembly

Related posts about beginner