[Ffmpeg-devel] [PATCH] video4linux2 input

Måns Rullgård mru
Mon Feb 6 18:14:35 CET 2006


Rich Felker said:
> On Mon, Feb 06, 2006 at 12:22:39PM +0100, Erik Slagter wrote:
>> On Sun, 2006-02-05 at 17:00 +0100, Aurelien Jacobs wrote:
>> > I disagree.
>> > It should probably read something like this:
>> >
>> > typedef enum {
>> >   QCIF = 0,
>> >   CIF = 1,
>> > } res_desc_t;
>> >
>> > if (width == 176 && height == 144)
>> >   return QCIF;
>> > else if (width == 352 && height == 288)
>> >   return CIF;
>> > else
>> >   return -1;
>>
>> To be even more elegant, I'd use a enum AND a table. #define's for
>> constants are evil, indeed.
>
> Do you have any good reason to say this or is it just more CS dogma?

The one good thing with enums is that debugger can show the symbolic names.
Apart from that, they are semantically equivalent to ints IIRC, with the
addition of polluting the namespace.  I rarely use them (or debuggers).

-- 
M?ns Rullg?rd
mru at inprovide.com





More information about the ffmpeg-devel mailing list