'static' in headers - what's all that about??!

The whole point of so-called “header” files in ‘C’ is to share stuff between source files;

The whole point of the ‘static’ keyword (at file scope) in ‘C’ is to make stuff private so that it is not visible to other modules.

So what on earth is the point of declaring variables as ‘static’ in header files :open_mouth: :question: :exclamation:

I ask because, as far as I can see, it is pointless; counter-productive, even.

In fact, I might even go as far as to say that it’s wrong.

Unless someone can point-out a reason (preferably, a good reason) for doing it… :question:

It may be used to provide the same set of variables for every module of wavecom’s API. For example if you have TCP Client module and UDP Client module, you probably have the same set of variables used in each of modules and the same set of functions. Now you could use static variables in header to provide a kind of inheritance but it is not the best solution…

I guess that could be possible.
But I think it’d get very confusing for each module to identically-named and identically-typed but distinct variables!

In fact, It’s the C-GPS samples that I’m looking at - and that’s not the reason here.

All these static declarations - including static function declarations - mean that it’s impossible to use the headers for their normal purpose of sharing the interface between modules! :angry:

I think this is actually a shoddy attempt to fix problems in some earlier version where these headers caused “multiple definition” errors.
Can’t seem to find the thread now…

There’s a mention here: https://forum.sierrawireless.com/t/migrating-to-m2m-studio-from-vs-2008/4148/4