3 ms·
Huh. That's clever. This approach should also work in other languages, say, C/C++/C#. I don't remember if C uses structural identity for struct types, but it mi
by krylon 10y ago
Huh. That's clever. This approach should also work in other languages, say, C/C++/C#. I don't remember if C uses structural identity for struct types, but it might work.
- jononor 10y agoNo identity or equality concept in C for structs apart from their address, I'm afraid. In C++ one can define a comparison operator, but it has to be implemented manually. Not that you can use the language-provided == on floats anyway, due to precision issues you should always check if the difference is below a specified limit...
- krylon 10y ago> Not that you can use the language-provided == on floats anyway, due to precision issues you should always check if the difference is below a specified limit... Hehe, I've been there. ;-) Fortunately, that code dealt with physical coordinates, so if two points were less than 100µm apart, they were equal for our purposes.