I’m not sure what this inline assembly does:
asm ("mov %%esp, %0" : "=g" (esp));
especially the : "=g" (esp) part.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
"=g" (esp)defines an output for the inline assembly. Thegtells the compiler that it can use any general register, or memory, to store the result. The(esp)means that the result will be stored in the c variable namedesp.mov %%esp, %0is the assembly command, which simply moves the stack pointer into the 0th operand (the output). Therefore, this assembly simply stores the stack pointer in the variable namedesp.