what are the contents that a stack in a compiler usually contains ?...and i am sure that it contains local variables and function address... but my question is what more it contains... i got this during my technical interview...
what are the contents that a stack in a compiler usually contains ?...and i am sure that it contains local variables and function address... but my question is what more it contains... i got this during my technical interview...
It depends on the architecture and calling convention. In general locals that won't fit in registers will be put on the stack.
Function parameters that won't fit in registers will go on the stack
I think variadic function arguments really always go on the stack.
Any other state that needs to be saved and restored..... possibly extra bits of frame information if specified by the calling standard.
I can't think of anything else off the top of my head, but I'm not really an x86 expert. Try googling the architectures you're interested in along with 'procedure calling standard' or 'calling convention'. Those documents will describe how the stack will be used.
This page looks like it might be helpful - Intel x86 Function-call Conventions - Assembly View
Function call return addresses are stored on the stack as well.
Kurt
thank u....Lec-4 C Programming-III - YouTube.....this video explains still more clearly.... hav a look buddy!!