News for hackers. Stuff that matters.
Re:You Can't Always Hash Pointers in C (2016) by TrinaryWorksToo on Wednesday September 19, 2018 @11:25AM (#18024843)
In golang it is purposefully randomized on every execution to prevent you from relying on iteration order
Re:You Can't Always Hash Pointers in C (2016) by delhanty on Wednesday September 19, 2018 @08:48PM (#18028862)
That's actually better than the situation in C.

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.

Re:You Can't Always Hash Pointers in C (2016) by wutbrodo on Thursday September 20, 2018 @04:50PM (#18035347)
Yea I wasn't sure enough to make a stronger claim, but I don't believe I've ever used ordered iteration of a hashtable. I feel like if I was tempted to do so, it would prompt me to rethink my design. Call it an "algorithm smell"