Unless, you have a particular love for debugging non-reproducible behavior that is.
Unless, you have a particular love for debugging non-reproducible behavior that is.
`malloc` doesn't have to give you the same pointer the next time the program is run - and sometimes it doesn't.
In that case, the ordering of the hash table on iteration can change.
Particularly, release build `malloc` and debug `malloc` are likely to differ, leading to bugs in production that don't reproduce when debugging.
Generally speaking, if your program depends on the stability of hash-table enumeration order, you're doing something wrong in the first place.
The point is not all programs are correct.
If you're trying to reproduce a bug that occurs in the release version, but goes away in the debug version (because hash-table enumeration order changes) that makes life more difficult.
Order-dependent iteration of a hash table's items isn't exactly a central use case of the data structure and often isn't even guaranteed. I don't think that this example is really sufficient to suggest that hashing pointers is a bad idea (though it may be for other reasons).
In C, debug `malloc` may very well behave the same run after run.
Then you move into production, and release `malloc` behaves differently to debug `malloc`.
Suddenly a latent bug that was there all along shows itself in release, but fails to reproduce in debug.
With the randomized behavior you describe in golang, the bug probably will show in debug and be caught.
No that's false. See my clarification above.
I know very well where and how I'm able to compare ptrs in a hash table, and I'm doing it all the time. just complaining out loud is no solution.