This is not strictly a programming question but more of a design question.
Working with some strucs from the WinAPI I noticed that many of them contain a field called dwSize that simpally stores their size e.g THREADENTRY32 or BLUETOOTH_DEVICE_SEARCH_PARAMS
typedef struct tagTHREADENTRY32 {
DWORD dwSize;
DWORD cntUsage;
DWORD th32ThreadID;
DWORD th32OwnerProcessID;
LONG tpBasePri;
LONG tpDeltaPri;
DWORD dwFlags;
} THREADENTRY32;
Thinking about this design i find it intriguing why can’t the code that using those structures use sizeof?
What is the actual thinking behind this?
>Solution :
This is to support future versions of that structure that might have new fields added to it.