If I declare static const variable in header file like this:
static const int my_variable = 1;
I answered this at length here. That answer is for C++, but it holds true for C as well.
The translation unit is the individual source file. Each translation unit including your header will "see" a
static const int. The
static, in this context, means the scope of
my_variable is limited to the translation unit. So you end up with a separate
my_variable for each translation unit ("
The compiler would not be "smart" to create only one instance for all files, it would be faulty, because you explicitly told it not to do so (