C
CptDondo
I've got a question on the proper handling of sizeof.
I have two files; a.c and b.c
In b.c I have:
struct Key en_keys[] = {
{EN_ENTER, DELAY, NULL},
};
in a.c I have
extern struct Key en_keys[];
and later, in a.c I do
foo = sizeof(en_keys);
Of course the compiler promptly pukes since sizeof is computed at
compile time and it doesn't know the size until link time....
So - what's the proper / recommended / sensible way to deal with this?
The number of elements in en_keys[] could change and I really don't want
to have to redo all of the size info.
I have two files; a.c and b.c
In b.c I have:
struct Key en_keys[] = {
{EN_ENTER, DELAY, NULL},
};
in a.c I have
extern struct Key en_keys[];
and later, in a.c I do
foo = sizeof(en_keys);
Of course the compiler promptly pukes since sizeof is computed at
compile time and it doesn't know the size until link time....
So - what's the proper / recommended / sensible way to deal with this?
The number of elements in en_keys[] could change and I really don't want
to have to redo all of the size info.