@Medinoc said in Best Linked List Ever:
@PleegWat Well, Win32 guarantees that Win32 handles have the bottom two bits available for special use, and those are stored as pointer types, so all platforms that run Windows should offer guarantees that this doesn't cause UB.
And as Raymond Chen mentioned, Win32 does NOT guarantee the same about process IDs.
At that point you're targeting a single platform (windows) on a single architecture (x86) with a single compiler (whatever the windows standard libraries get compiled with).
To your own code, those values are simple 32-bit or 64-bit integer values. Despite being implemented as pointers they may not even point to a specific memory location in your address space. As such from the viewpoint of your code, there is no UB. If the standard library implements this in C, it is almost certainly UB. If it implements it in inline assembly or some other language, I'm not sure on the UB implications. Technically, UB is a poisoned chalice and UB in the standard library poisons your entire application with nasal demons. In practice, UB is a compiler concept not a processor concept, and in absence of certain types of link-time optimisation (which isn't performed here because dlls) the poison cannot spread.