What I have is an array of unsigned chars the first byte is actually the number of elements in the array. So is it possible to have the compiler calculate the size of the array using sizeof()? or is there some other way?
#define MENU(ID) menu_##ID #define MENU_CNT_P(N) ((sizeof(MENU(N))-1)/sizeof(menu_position))
This of course gives 0 for the sizeof() value because the array isn't defined. Suggestions/thoughts welcome. Stephen
I don't think so, unless you tell the compiler the size of the string. You might declare the array with a fixed length that is longer than the longest one you will use +1, but that might defeat the purpose. I don't know the particulars. I know of no way that any compiler could guess the size of an unknown array...