3 ms·
> What's the use case for it outside of, say, binary executable loaders? If you're doing low-level optimizations, and you know that your pointed-to objects are
by adwn 6y ago
> What's the use case for it outside of, say, binary executable loaders?
If you're doing low-level optimizations, and you know that your pointed-to objects are, say, 8-byte-aligned, then you can use the lower 3 bits of your pointer for storing metadata. In certain cases, that can be immensely useful. Some GC implementations use this trick, for example.
- ralfj 6y agoOne could imagine a specific primitive operation in the language that lets you adjust the low bits of a pointer without casting it to an integer and back.