I came across this Enum and Struct declarations in a project supposedly done by an expert. The declarations / definitions are little different than what im used to so far.
enum EnumKeys {
KEY_MENU ,
KEY_EXIT ,
KEY_DOWN ,
KEY_UP ,
KEY_RIGHT ,
.
.
.
};
But nowhere in the code the actual Enum had been defined by a line of code like
EnumKeys test;
for example. But still the KEY_MENU, KEY_EXIT are freely available just after this declaration. For example, if I type cout << KEY_EXIT
, it prints 1.
Other instance is, this structure declaration / definition.
typedef struct t_ExpoData {
int8_t expNorm;
int8_t expDr;
int8_t drSw;
}ExpoData;
typedef struct t_ModelData {
...
...
ExpoData expoData[4]; // 3*4
}ModelData;
So the way I read this is, there is a new structure with the name ExpoData and one instance of it is ExpoData.
Instead of using that instance right away, why the second declaration ExpoData expoData[4]
?
If anyone understands this, as of what clang specification is this, and how to interpret this correctly, that is much appreciated.