by wutbrodo · 8y ago · 0 comments
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.