[FFmpeg-devel] [PATCH] MMX for Win64

Måns Rullgård mans
Wed May 7 12:05:42 CEST 2008


Reimar D?ffinger wrote:
> On Wed, May 07, 2008 at 10:27:57AM +0100, M?ns Rullg?rd wrote:
>> Baptiste Coudurier wrote:
>> > M?ns Rullg?rd wrote:
>> >> There are good reasons not to use typedefs for structs (or pointers).
>> >> I avoid doing it in new code.
>> >
>> > Oh, can you please elaborate a little ? Im really interested in knowing why.
>>
>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/CodingStyle;hb=HEAD#l270
>>
>> Extrapolate from there.
>
> Well, the thing that is the major claim, namely 'Lots of people think
> that typedefs "help readability". Not so.' is not exactly convincing.
> Luckily it's usually only one function argument that is a struct, but
> if only considering readability I find
>> int function(actx_t *a, bctx_t *b, cctx_t *c);
> much better than
>> int function(struct actx *a, struct bctx *b, struct cctx *c);
> because the "struct"s use up a lot of space without adding any useful
> information.

But they do add information.  A function argument of type pointer to int
is usually used to return a value, whereas a pointer to struct is commonly
used for both input and output values.  The point is, immediately seeing
that something is a struct, without searching for a definition, is often
helpful, especially to other people than the author of the code.  That you
don't find it useful, doesn't mean that others do not.  In fact, it could
be that you have not learned to use all the information given to you.
Perhaps it's time to expand your skill set.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list