Not in C.Operator overloading is doable in any language that supports user defined data types, including C
Well, they are not C compilers then are they.An example of how it is done in some C compilers that bend the rules a little (by allowing operator overloading) is below
Out of interest what compilers do you mean and where can I get them to play with?
Inlining is neither here nor there in this discussion. That is an optimization a compiler may or may not perform.Remember that we now have inline functions in C,
Again, I say, they were not C compilers. And I'd be interested to know exactly what they were and how to get one to play with.I have used a few C compilers that allow this,... you can do the exact same thing in C++, and it works (leave out the OO stuff completely).
Now, looking at your example, it seems to me that much the same could be done in C++. But it does not save you any effort.
Instead of "typedef struct {...} PIX" we have "class PIX {...}"
Instead of free standing overload functions with two pointers like "PIX operator+(PIX *src, PIX *trans){...}" we put them into the class and only have one parameter, the other being the "this" pointer of the instance itself, like so: "PIX operator+(PIX *trans){...}"
One could write much the same as you present in C++ but I see no point to it. Either way the actual work you have to write to implement your data type still has to be done.