I've found the following example in a technical book
struct {
tBoolean logON;
static enum eLogLevel outputLevel[NUM_LOG_SUBSYSTEM];
} sLogStruct;
static struct sLogStruct gLogData;
but I was confused about the goodness of the struct declaration that, formally, should rather be
struct name {
...
}
in fact, I make some trial and the compiler comes out with an error at the statement (I really tried with standard types and not with something like sLogStruct)
static struct sLogStruct gLogData;
Is my doubt right and the code is faulty?
In addition I'd like to understand the meaning and the scope of static class storage within a struct as I did't find any satisfying explanation. Let's have a struct declaration like this
struct myStruct {
int Foo;
static int sFoo;
} strA, strB;
does strA and strB have two static variable indipendent to one another?