So I know this was a rookie mistake, but it took me hours to figure out a memory corruption issue. Maybe the compiler can help.
Type checking and sizing are routine in the compiler such as char vs. wchar_t, or int to long int.
My error was in one module I had declared a global array like int a[11][7][40]; in another module I needed to access this variable. So I put it in as extern int a[11][7][40]; - so far so good. Everything fine, worked great. By module I mean a C procedure file.
Now my mistake was created by changing the original int a to int a[11][
8][40];. The program worked fine everywhere until I tried to use element [
8] in the module where it was extern. Of course when I
finally found and changed the extern a to the new a[11][
8][40]; everything was good again.
So it seems that the compiler does not check any extern declaration against the 'original' declaration. This includes procedure declarations and well as variable declarations.
Is it worthwhile and possible to implement such checks? Perhaps is it such a rookie mistake not worth the code …..
Anyway I learned to be careful with using extern
John Z