http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54505

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steven at gcc dot gnu.org

--- Comment #1 from Steven Bosscher <steven at gcc dot gnu.org> 2012-09-06 
17:29:02 UTC ---

struct context;

#undef ONE
#undef EIGHT
#define ONE(X)        extern const int f0##X (struct context *);
#define EIGHT(X)    ONE(X##0) ONE(X##1) ONE(X##2) ONE(X##3) \
            ONE(X##4) ONE(X##5) ONE(X##6) ONE(X##7)
EIGHT(0)
EIGHT(1)


#undef ONE
#undef EIGHT
#define ONE(X)        [X] = f0##X,
#define EIGHT(X)    ONE(X##0) ONE(X##1) ONE(X##2) ONE(X##3) \
            ONE(X##4) ONE(X##5) ONE(X##6) ONE(X##7)

static const int (*ftable[])(struct context *) = { 
EIGHT(0)
EIGHT(1)
0
};

extern int foo (int, struct context *);

int
foo (int v, struct context *context)
{
  ftable[v](context);
}

Reply via email to