Hi, this seems like it might be a bit of a FAQ or common pattern, for those
working in C (e.g. implementing native types).
In C, I can easily get a string and do a few if statements with strcmp to
decide how to handle it. If the methods were called infrequently, I might
not be concerned.
What I'm wondering is, if there is a way to avoid the strcmp logic by
directly comparing some interned strings, or something like that.
Sort of like:
- in C, grab a copy of the few strings I'm interested in, in some sort of
reference
- in C, when methods come in, check the string args (on the stack) against
the references grabbed
So that the check is more of a pointer compare than a strcmp.
Is there a pointer to sample code (e.g. users wiki) showing how this is
commonly done, gotchas, etc.?