On Fri, Aug 15, 2008 at 10:38 PM, Richard Harvey Chapman <hchapman-gcc-help@xxxxxxxx> wrote: > I'd like to shorten-up so redundant code in a switch statement by using a > macro for each case. The following code illustrates the problem. In short, > is there a way to write the PARSE(a,b) macro that will work in the manner > shown below? How about something like this: #define rhc__A 'A' #define rhc__B 'B' #define rhc__C 'C' #define rhc__D 'D' #define rhc__E 'E' #define rhc__F 'F' // etc. // * not allowed in case statement #define PARSE(a,b) case (rhc__##a << 8) | rhc__##b: \ status = Parse##a##b(); \ break This depends on a reasonable-sized alphabet, of course!