3 ms·
Yes, I am intentionally not looking at the types, because that's something that might not be incredibly apparent in C++ (or C). We're violently agreeing at thi
by dymk 8y ago
Yes, I am intentionally not looking at the types, because that's something that might not be incredibly apparent in C++ (or C).
We're violently agreeing at this point. Yes, in C, this problem does not exist, because operator overloading does not exist.
In C++, what `A+B` does is ambiguous without knowing 1) what are the types of A and B, and 2) what are all the possible `operator+` overloads that exist which may operate on A and B. It's a hidden complexity which doesn't make potentially expensive operations apparent, and kernels and VMs hate that kind of thing.
- kllrnohj 8y ago> because that's something that might not be incredibly apparent in C++ (or C). Yes, it is. Extremely so. > Yes, in C, this problem does not exist, because operator overloading does not exist. Except it totally still does because you never know what function add does for random types. It's literally the same exact thing. Function calls might be expensive and they might not be. > It's a hidden complexity which doesn't make potentially expensive operations apparent, and kernels and VMs hate that kind of thing. No, it really isn't. The add overload operator is never non-obvious, and never actually does memory allocation, file io, or any of that other nonsense. Can you be intentionally stupid about it? Yes, sure. Is that an actual concern that anyone working on a VM or kernel should have? No, not in the slightest. Completely nonsense.