i've been writing bits of codes where it requires to have an array or
"pointers to functions", so the decision of which function to execute is
indexed... (i know, a lot of you will say "well, that's a VERY specific of a
solution, there's always the problem of binary compatibility when passing
arguments for different argument-taking functions, blah, blah, blah... just
rely on good old fashioned function calls with conditional statements..."
but, pls, forget about that sort of incompatibility...)
even if i hadn't tried it in C++, i know it should work as i've seen some
examples posted on the net. but i'm trying to write my code in GNU C, so it
could be compiled by GCC -- god knows i would never try to compile it in GNU
C++; that gargantuan thing
but whatever i do it i just can't get it to work
code:
some_header.h:
static void *(*oper_table)(void **);
main.c:
int main(void)
{
oper_table[0]; /* just a test. data is not used or modified*/
return 1;
}
error: subscripted value is pointer to function
whereas:
int main(void)
{
void *(*func)(void **);
func;
return 1;
}
compiles just fine
i do realize that i'm depending on dialect-specific features, so i don't
even know if this is supported on my gcc as of version 4.3.3. if it's not a
dialect problem, then this stumps me even more.
--
View this message in context:
http://old.nabble.com/array-of-pointer-to-function-support-in-GNU-C-tp29725303p29725303.html
Sent from the gcc - Dev mailing list archive at Nabble.com.