Hi all,

I'm currently making an IRC client, and I'm trying to decide / develop the best hash algorthim to use for the message codes received.

i.e. my parser will already have determined a message code to be, say, "PRIVMSG".

It will then perform a hash lookup on that string to determine the next function to execute (parsing the privmsg, passing it to the relevant server/channel, etc.), in order to bypass a mass load of:

if ( _tcscmp(pszCode, TEXT("PRIVMSG")) == 0 ) { funcPrivmsg(); }
else if ( _tcscmp(pszCode, TEXT("439")) == 0 ) { func439(); }
As all the codes (in their current states, at least) are known compile-time I should be able to use a perfect algorithm for it, but having never used or made a lookup table before, I'm merely seeking guidance for the best way I can implement & make such a table & hash function. I figure the table can be 1024 in size (999 numericals + text-based codes, power of 2), and only needs to store a function pointer (all the functions have the same declaration and parameter types).

Naturally I'd be after the fastest possible route too, so if additive hashing can generate what I'd need, that'd be fine!

I've already checked out some great (and *very* in-depth) discussions & samples but just need a push in the right direction to get me going!