We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello all, I have the following situation and error message that I'm not quite able to wrap my head around. I have a module, let's call it table.c that has something like the following. code const entry_type table[] = {...}; code const unsigned int tablesize = sizeof(table); Of course, ... is replaced by a bunch of table data. In another module, call it access.c, I have the following: extern code const entry_type table[]; extern code const unsigned int tablesize; code const unsigned int entrysize = sizeof(entry_type); code const unsigned int numentries = tablesize/entrysize; I receive an error C247 when trying to compile the line where I calculate numentries. Oddly enough, it doesn't complain about calculating entrysize, so it's good with making that a code constant. Nor does it have a problem in table.c creating the tablesize code constant. I'm not sure why then it wouldn't think that numentries could be a code constant. I've also tried making sure that table.c is compiled before access.c (just a blind attempt) and that didn't help. Any help would be greatly appreciated. Best Regards, Jay Daniel
Hans-Bernhard, Thanks for the explanation. I actually wanted some way to size another array to match it, but have resigned my self to working around this another way. I figured it was worth asking though.