This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Popping registers
- From: "Sam Lauber" <sam124 at operamail dot com>
- To: "Peter Barada" <peter at the-baradas dot com>, gcc at gcc dot gnu dot org
- Date: Tue, 21 Dec 2004 03:21:22 +0100
- Subject: Re: Popping registers
I didn't know that registers are on a stack.
>> What is a stack? What does the compiler use it for? Why would messing
>> with it be a bad idea? And no, I do not know assembly, and I haven't
>> had computer science class yet.
>
> Well if you don't know what a stack is, then why are you asking how to
> pop from it? :)
>
> The stack is where the program allocates local storage and
> pushes parameters and save/restores registers used by called functions
> as well as save the return address when it calls another function so
> the called function knows where to access the parameters and how to return to
> the caller function.
>
> Directly or indirectly modifying the stack pointer behind the back
> of the compiler is *really* asking for trouble since modifications to
> the stack pointer that are not known to the compiler will break the
> ABI and cause you rprogram to "go off into the weeds" with no hope of
> understanding why. Richard is right; it is *definitely* something you
> don't want to do in C. If you have to abuse the stack, then roll up
> your sleeves and write in assembler.
>
> Perhaps the real question is to ask *why* you believe that you need to
> pop a value from the stack(and thereby modify the stack pointer)?
>
> Do some research on what a stack is and how its used in
> programming(here Google is *definitely* your friend).
>
> --
> Peter Barada
> peter@the-baradas.com
--
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
From your mailbox to local or overseas cell phones.
Powered by Outblaze