News for hackers. Stuff that matters.
Re:Implementing UFCS for C++ in Clang by invokestatic on Monday August 03, 2020 @03:07PM (#24041972)
A common idiom in C APIs is to pass a struct pointer as the first argument to functions (as sort of a pseudo-thispointer). It would be nice to have this extension at least simply for syntactic sugar for C interoperability.
Re:Implementing UFCS for C++ in Clang by secondcoming on Monday August 03, 2020 @07:43PM (#24044843)
This is exactly what 'this' is in C++, it's a pointer to the class/struct instance and the compiler inserts it as the first parameter behind the scenes. There's no difference between a class method and a class static function that takes a pointer to a class insance as its first parameter.
Re:Implementing UFCS for C++ in Clang by acqq on Monday August 03, 2020 @03:48PM (#24042473)
On another side, one can argue that the implemented "unification" is anyway just for a convenience of using a dot call instead of just passing the reference to the object as the first parameter of a "plain" function call.