On 05.06.2017 17:28, Henri Verbeet wrote:
On 3 June 2017 at 03:13, Alistair Leslie-Hughes leslie_alistair@hotmail.com wrote:
The purpose is to make a type. For example without it every time we needed to use it we would have to use "struct _mfmediatype name", but with the typedef we can shorthand it to "mfmediatype name".
That's a rather poor justification for using typedefs, but unfortunately also a really common one. What you're essentially doing is obfuscating the fact that something is a structure/enum/integer/pointer/etc., only to avoid a few keystrokes. One of the reasons that's odd is that the time spent typing in the code should be small compared to the time spent thinking about the problem you're trying to solve.
That justification is not really strong either. I don't see how using them makes code you're commenting any less readable. When it comes to personal preferences, in case of COM objects, the object name is often a public typedef from coclass declaration (although not in case of this particular type). Although there is no technical reason to use different declarations, I'd argue that it's the most intuitive choice.
That said, there are different preferences. Alistair chose a declaration consistent with existing code within DLL, so I'd say he did the right choice.
Jacek