3 ms·
Like you, I have no idea what use the unique 0-sized pointers would provide. SANE_REALLOC_EMPTY is certainly adequate for me. Thank you!
by amavect 2y ago
Like you, I have no idea what use the unique 0-sized pointers would provide. SANE_REALLOC_EMPTY is certainly adequate for me. Thank you!
- kazinator 2y agoIn a Lisp implementation, I could use unique, zero sized objects to implement symbols. The gensym function would create a new one. Zero-sized distinguishable objects can have properties attached to them via hashes. At the API level, you cannot tell how a property (e.g. symbol-name) is attached to an object. Properties, like the symbol name, would be attached to these objects via hashes. It's not an ideal representation for symbols when all symbols have a certain property, like name. If you have objects such that they have certain properties, but the properties are rare (only a few objects have a value of the property that requires storing space, and for the rest it is some "undefined" value, you can achieve a sparse representation by making the objects as small as possible, attaching the properties externally.