I am writing a program to print out a 32-bit number, and I was thinking of storing each digit on the stack, to make use of its last-in-first-off functionality. This arose the question, could I store 32 digits on the stack?
My question is, how many digits of information could I store on the stack? What is the limit of the number of things I can push onto the stack? Could I store 64 digits? 128? A number of arbitrary length?
Thanks in advance,
Rileyh
It’s not actually
nasmdictating this, more the linker that you use. Allnasmdoes is create object files which can be linked together.If you are using the
ldlinker from Linux, you’ll most likely find that your default stack is 2M.So, no, 32 bytes is not really going to have a massive impact on that and, even if you run out of stack, you can use something like
ld --stack 4194304to bump it up.