[Ffmpeg-devel] [PATCH] video4linux2 input

Oded Shimon ods15
Mon Feb 6 18:25:19 CET 2006


On Mon, Feb 06, 2006 at 05:14:35PM -0000, M?ns Rullg?rd wrote:
> 
> 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).

They are good only for switch/case stuff IMO. Not really useful for 
anything else.

- ods15





More information about the ffmpeg-devel mailing list