[v2 PATCH 2/3] mfplat: Implement MFCreateMediaType

Henri Verbeet hverbeet at gmail.com
Mon Jun 5 10:28:39 CDT 2017


On 3 June 2017 at 03:13, Alistair Leslie-Hughes
<leslie_alistair at 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's not to say there's never a legitimate reason to use a typedef
though. For example, a certain type may be implemented as a 32-bit
integer on one platform, a 64-bit integer on another, and a structure
on others. A typedef can be used to abstract between those by creating
an opaque type, like e.g. time_t. Such cases should be rare however.



More information about the wine-devel mailing list