PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Object function pointer

When calling an object's function, where is the object pointer passed? On the stack or in a register? I'd like to know for the ARM and Intel processors too.

I would like to call, let's say:

Code:
p = &classname;::functionname;


My object variable is called Obj for example. Where is Obj pointer passed when the function Obj.Function() is called?
The "this" pointer is usually passed in a register. On x86, this is the "ecx" register. Not sure about ARM.
Thanks Thierry. Anybody know about the ARM processor?
It's in R0.

A quick look at the disassembly of a function:

Code:
VectorFP::VectorFP(int nx,int ny,int nz)
{
x=nx;
y=ny;
z=nz;
}


Compiles as:

Code:
|??0VectorFloat@@QAA@MMM@Z| PROC ; VectorFloat::VectorFloat

; 73 : {

|$M24515|

; 74 : x = nx; y = ny; z = nz;

str r1, [r0]
str r2, [r0, #4]
str r3, [r0, #8]

; 75 : }

mov pc, lr
Thank you very much.