#Simulating c++ virtual methods issue
1 messages · Page 1 of 1 (latest)
is the this pointer guaranteed to be passed as the first argument, or how's that work?
yeah, it's always passed as the first argument in ecx
well, c++ is weird
I know msvc uses ecx, gcc is probably different
the wikipedia page on calling conventions disagrees
For the GCC compiler, thiscall is almost identical to cdecl: The caller cleans the stack, and the parameters are passed in right-to-left order. The difference is the addition of the this pointer, which is pushed onto the stack last, as if it were the first parameter in the function prototype.
always best to check what the code does and go from there