3 ms·
"Interestingly, the idea of hashing over the bytes of a data structure would be possible in C++, but it is non-idiomatic" Because it's not conformant. Those po
by jibal 8y ago
"Interestingly, the idea of hashing over the bytes of a data structure would be possible in C++, but it is non-idiomatic"
Because it's not conformant. Those possible C++ programs are broken.
- blub 8y agoI was making a point about language culture and decision making. Conformance is a property of the code, the programmer's decision process is the really interesting thing here to me and I was arguing that such a solution is not unusual for C, but it would be for C++ , where a programmer would avoid it not because it's not conformant, but because it looks odd. pjmpl further clarified that it depends on the type of C++ programmer - I agree.
- jibal 8y agoNon conformant code doesn't become an idiom, because it's broken. If you want to wrap that in a cultural framework, go ahead, but it rather misses the point. > I was arguing that such a solution is not unusual for C You may have asserted that (funny how people call their unsupported assertions "arguments"), but you're wrong if so. Again, it's broken, in C just as much as C++. You wrote > instead one would use hash functions for each type and in the case of a struct the individual members would be accessed to build the hash value. But this is just as much true in C as C++, because hashing pad bytes is wrong. In fact, C programmers are probably more aware of this than C++ programmers.