When reading through the calling conventions there is a thiscall convention which purpose is pretty clear.
I understand that thiscall defines a function which is part of a class, because these functions require an object as their first hidden parameter for non-static functions.
So if I understand it right, then the following function have to be thiscall. The keyword doesn't need to be used because the compiler doesn't have much choice there and have to declare it as such.
class Foo
{
public:
int function(void) { return 1; }
};
Now when I declare functions outside a class like this:
int __thiscall Otherfunction(void) { return 1; }
int __thiscall Otherfunction(Foo *t) { return 1; }
Then I get the compiler error:
error C3865: '__thiscall': can only be used on native member functions
It even makes sense because how would you call these functions? So why does this keyword even exist if it can not be used? Or is there some usecase where this can/has to be used?