In my SAX xml parsing callback (XCode 4, LLVM), I am doing a lot of calls to this type of code:
static const char* kFoo = \"Bar\";
void SaxCallBack(char* sa
Follow-up question:
Have you tested the following ?
static std::string const kFoo = "BAR";
void SaxCallBack(char* sax_string,.....)
{
if ( sax_string == kFoo)
{
}
}
It's a net win in readability, but I have no idea about the performance cost.
As an alternative, if you must dispatch by yourself, I have found that using a state-machine like approach (with stack) is much better readability-wise, and might also win performance-wise (instead of having a large number of tags to switch on you only have the tags that can be met right now).