[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: predefined constants
- From: Adrian Sietsma <adrian_groups@...>
- Date: Sat, 24 Jul 2004 12:33:01 -0700
Thanks Rici & Ashwin
for my first cut, i'll just use string labels; i have already considered
the "table of functions" approach, but that requires some redesign which
i wish to avoid at this time; it will probably end up there.
(the app is a state-machine based parser)
>The strings are interned at compile time so the string comparison is
>just a pointer comparison.
How does that work, if the strings are literals, not LUA vars ?
s = "TAG1"
if s=="TAG1" then ... end
<some code>
if s=="TAG1" then ... end
unless the lua compiler builds a stringtable of literals, it cannot know
that the three "TAG1" literals are the same, eg have identical pointers.
it's still only has to do a strcmp() or similar, but i can't see a
straight pointer comparison working with string literals.
Adrian