On Thu, May 21, 2020 at 6:51 PM Coda Highland <chighland@gmail.com> wrote:
> Are you aware of a linker that doesn't unify string literals?
Well, the boundary between the compiler and the linker is blurry these
days, but I'd say you would need to ask the compiler for that. In some
(debug?) builds this may be off by default.
Lua itself assumes nothing about that, keeping that string pointer in
the global state and using only the pointer after it was initialized.
I did not understand what Massimo was trying to achieve.
Cheers,
V.
It's not stored in the global state. It's a #defined constant, unless the earlier post was wrong about that. It would depend on the linker identifying that the different constant data symbols are in fact the same and can be updated to the same pointer.
If this can't be relied upon, then Massimo is completely correct that the comparison is wrong.
/s/ Adam