J
Jack Klein
Jack said:typedef struct
{
int (* func1)();
int (* func2)();
void * (* func2)(int );
} ModuleFunctions;
#define N 100
ModuleFunction garMF[N];
ModuleFunction garMF[N] = {NULL};
I would much prefer {0} to {NULL} here.
All of the members of all of the elements of the array
will be initialized to NULL. Why do you like {0} better ?
I should have elaborated. {0} works in all cases to initialize any
static or automatic scalar or aggregate type.
The C standard allows two definitions for the macro NULL. For
simplicity's sake, they are "0" and "(void *)0", or equivalent. My
experience is that most (but definitely not all) C compilers use the
cast to (void *) rather than the raw numeric constant.
In this case, since the first element of the structure has pointer
type, either definition of NULL will work. If the structure had a
non-pointer first member, it would be correct on implementations that
used a raw 0 for NULL, but be a constraint violation on those that
defined NULL as "(void *)0".
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq