But if you aren't writing a compiler or an embedded system, you should never do this.
But if you aren't writing a compiler or an embedded system, you should never do this.
That said, it's better to rely on RCU/hazptr to solve ABA issues, but the extra bits are still useful to store state that can be CAS'd together with the pointer.
But yes, it is definitely something to be aware of!
BTW, if the pointers are always aligned, the sequence number may have a few bits more.
I have this hex trie library that uses this to differentiate between a leaf and a node that will soon be optimizing single-value nodes as tagged pointers. __edit__ umm... single-value nodes are leaves!?! Yeah, not enough coffee apparently.
Not to mention the tinyscheme interpreter I occasionally poke at that TFA gave me a bunch of ideas to try out.