Link to home
Start Free TrialLog in
Avatar of Sandra-24
Sandra-24

asked on

thiscall

Just a quick question, if you code a member function in assembler, the this pointer is passed as ecx.

Can you use ecx then without the need to save it to the stack and restore it when your finished?

Or will the compiler assume that since it already put the this pointer into ecx, it can skip that on the next member function call.

Is there any way to tell? I looked at the disassembly but didn't see anything conclusive one way or the other.

thanks,
-Sandra
SOLUTION
Avatar of dimitry
dimitry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sandra-24
Sandra-24

ASKER

Well I read through the VC docs again on calling conventions and didn't find any help one way or another. I also followed a few threads on thiscall and assembly but didn't learn anything of value. I checked google again but also found nothing. I suppose the best is just be safe and save the value of ecx on the stack and restore it after.

thanks,
-Sandra
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial