The article says:
"So when you change what + means, it will throw away all those methods it compiled with the old definition. Poof. Gone."
Is this enough? What about the function's side effects?
If the function changed 1000 variables with the wrong + definition, is it going to roll them back?
That's not the point. It's perfectly safe and there's nothing else in C.
The point is you don't have to call this function for every single word. It takes time and pointer increment doesn't
Another 1 minute lookin... multiplication on every byte.. really?
If this is supposed to be fast, get one big buffer for the words. Get another if you run out.
The hash function can be the word itself for words up to length 8.
Longer words would need a mult per 8 bytes.
You can do branchless strchr.
Roll your own memmove - just always copy 24 bytes and terminate at the length you already know.
The whole point of using C or C++ is that you can do non idiomatic things when you have to.
- Not use Intel processors, as many are developed in Haifa
- Not use a firewall. It was invented in the IDF.
- Not use Waze. It's Israeli.
- Not use thumb drives. Invented in Israel.
- Not eat cherry tomatoes. Israeli development.
The list goes on and on, but I must add - if you ever suffer a serious head or stomach injury, tell the medics to not use the Israeli bandage.