On May 6, 2021, at 7:16 AM, Vitaly Isaev <vitalyisa...@gmail.com> wrote: > > There is no similar type in C/C++/Go stdlib, but at least in C++ it's > possible to model it using bit stealing approach (see C++ example). On x86_64 > arch only 48 bits of 64 bits are actually used, so one can store arbitrary > data in the remaining 16 bits, and work with the whole pointer and the data > atomically.
I would strongly recommend that you not do this, because this has a nasty way of breaking a LOT of things in the future. The original Macintosh system software and ROMs used this "clever" technique almost exactly, because the 68000 only had a 24-bit address bus. When the 68020 came out and people wanted to use more than 16 MB of address space, it created BIG problems which took many years to resolve (and many things were not completely resolved until Apple moved to the PowerPC). History is littered with examples of why you should not do naughty things with "unused" pointer bits (see also ARM's Thumb instruction set, which used the unused LSB of the instruction counter to signify Thumb mode, causing headaches for compiler, debugger and disassembler writers to this day). - Dave -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAF81D0A-9AD0-4412-9013-76FEB6C13C27%40gmail.com.