> How would you access individual characters of a string in the > preprocessor? Indeed, the preprocessor can't look 'inside' a string literal. The only technique I can think of that would work would be something like: *** WARNING: Untested code *** #define H(partial,c) ((partial) << 1) ^ (c) unsigned int hash(char const *p) { unsigned partial=0; while ( *p ) { paritial <<= 1; partial ^= *p; ++p; } } .... char *p; switch hash(p) { case H(H(H(0,'a'),'b'),'c') : DoSomething(); break; case H(H(H(H(0,'d'),'e'),'f''),'g'): DoSomethingElse(); break; default: UnknownCommand(); } ----- you could define macros like: #define H1(a) H(0,(a)) #define H2(a,b) H(H1(a),(b)) #define H3(a,b,c) H(H2(a,b),(c)) #define H4(a,b,c,d) H(H3(a,b,c),(d)) then your cases would be: case H3('a','b','c'): .. case H4('d','e','f','g'): ----- --- Bob Ammerman RAm Systems -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist