3 ms·
Because different versions of the struct have different sizes. That’s a C artifact.
by Ididntdothis 7y ago
Because different versions of the struct have different sizes. That’s a C artifact.
- leetcrew 7y agoI figured it's one of those structs where the macro can resolve to a few different types depending on what's #define'd, but the implementation should still be able to use sizeof wherever it's needed. I do believe there's a good reason; I just can't figure out what it is. edit for any curious readers: I found an answer here https://stackoverflow.com/questions/30416191/why-do-some-winapi-functions-need-sizes-of-structs-passed-as-their-parameters/30416321 https://stackoverflow.com/questions/30416191/why-do-some-win...
- Ididntdothis 7y agoYou can and should use sizeof in your code. The Windows code needs to know the size so it knows what version of the header the code was compiled against. There are probably other ways to do this but sizeof is not bad. That’s how they can get backwards compatibility over decades.