inventing new, bad, and worse ABIs. rotating them in my brain
@iximeow __thatcall. Pointer to the *caller* is passed as the first argument.
Useful for runtime versions of public/private/protected, where a method can refuse to be invoked from a particular chunk of code.
@azonenberg @iximeow awful. thank you
@azonenberg @iximeow
but the return address is already on the stack...
@tthbaltazar @iximeow no like the address of the object making the call not the pc value. So if you call foo.bar() and bar then calls __thatcall baz(), the "that" pointer of baz will point to foo.
@tthbaltazar @iximeow so you can then do ugly things dynamic_casting "that" to figure out what type of object called you, etc.
If you're called from a global or static function, "that" is nullptr.
@azonenberg @tthbaltazar @iximeow GameMaker has "self" and "other" which do pretty much that: https://manual.gamemaker.io/monthly/en/GameMaker_Language/GML_Overview/Instance%20Keywords/other.htm
Internally they're represented as negative numbers that get resolved ~lazily, which is a weird/fun gotcha if you store it in a struct and read it somewhere else (and possibly if you pass it in method arguments).
(I have never used GameMaker so I may be mischaracterizing it slightly.)
@azonenberg @iximeow I've seen R code doing that.