typedef struct _VIDEO_STREAM_CONFIG_CAPS
{
GUID guid;
ULONG VideoStandard;
SIZE InputSize;
SIZE MinCroppingSize;
SIZE MaxCroppingSize;
int CropGranularityX;
int CropGranularityY;
int CropAlignX;
int CropAlignY;
SIZE MinOutputSize;
SIZE MaxOutputSize;
int OutputGranularityX;
int OutputGranularityY;
int StretchTapsX;
int StretchTapsY;
int ShrinkTapsX;
int ShrinkTapsY;
LONGLONG MinFrameInterval;
LONGLONG MaxFrameInterval;
LONG MinBitsPerSecond;
LONG MaxBitsPerSecond;
} VIDEO_STREAM_CONFIG_CAPS;
Why not define structure VIDEO_STREAM_CONFIG_CAPS directly instead of involving _VIDEO_STREAM_CONFIG_CAPS?
Quite simply (at least for me) because some people like to be able to treat user defined types as “primary” types.
Just like I wouldn’t like to have to say:
I prefer:
to:
In fact, I usually get rid of the structure tag altogether, preferring:
The only time I genarally use the tag is if I have to refer to the type within the type definition itself, such as in linked lists:
That’s because, at the time of creating the definition,
tNodedoesn’t yet exist butstruct sNodedoes (you can think of it as a simple sequencing thing if that makes it easier –struct sNodegets created on line 1 above,tNodeon line 4, which means on line 3 where you create thenextpointer, you have to use the structure name).In the case you cite, the structure tag is superfluous at least in the code shown. Whether some other piece of the code declares a variable with the structure name rather than the typedef name is unclear.