With xc8 you have to be careful about declaring a variable
as the same type in each file as you could , erroneously,
declare something an int in one file and a char say in another.
This could lead to corruption of variables.
This problem was elegantly solved in a microchip forum some 15 years ago
/* See "http:www.htsoft.com" /
/ "forum/all/showflat.php/Cat/0/Number/18766/an/0/page/0#18766"
But this link seems to no longer work...
So I;ll quickly try to explain it;
make a file called global.h.
In it declare the following
#ifdef MAIN_C
#define GLOBAL
/* #warning COMPILING MAIN.C */
#else
#define GLOBAL extern
#endif
GLOBAL unsigned char testing_mode; // example var used in several C files
Now in the file main.c
#define MAIN_C 1
#include "global.h"
#undef MAIN_C
This means in main.c the variable will be declared as an unsigned char.
Now in other files simply including global.h will
have it declared as an extern for that file.
extern unsigned char testing_mode;
But it will be correctly declared as an unsigned char.
The old forum post probably explained this a bit more clearly.
But this is a real potential gotcha when using a compiler
that allows you to declare a variable in one file and then declare it extern as a different type in another. The problems associated with
that are if you say declared testing_mode as an int in another file
it would think it was a 16 bit var and overwrite some other part of ram, potentially corrupting another variable. Difficult to debug!