[libdvdcss-devel] [PATCH 1/4] Replace DVD access method #defines by an enum.

Diego Biurrun diego at biurrun.de
Mon Nov 3 10:11:51 CET 2014


On Mon, Nov 03, 2014 at 10:05:23AM +0100, Fabian Greffrath wrote:
> Am Montag, den 03.11.2014, 09:53 +0100 schrieb Diego Biurrun: 
> > On Mon, Nov 03, 2014 at 09:50:06AM +0100, Fabian Greffrath wrote:
> > > Am Samstag, den 01.11.2014, 17:56 +0100 schrieb Diego Biurrun: 
> > > > +enum dvdcss_method {
> > > > +    DVDCSS_METHOD_KEY,
> > > > +    DVDCSS_METHOD_DISC,
> > > > +    DVDCSS_METHOD_TITLE,
> > > > +};
> > > [...] 
> > > > +    enum dvdcss_method i_method;
> > > 
> > > Why don't you use typedef enum?
> > 
> > I'll turn this around - why should I typedef?
> 
> Because then you could declare the variable without having to duplicate
> its enum type:
> 
> typedef enum dvdcss_method {
> ...
> } dvdcss_method_t;
> [...]
> dvdcss_method_t i_method;

And what would I have gained apart from typing 3 characters less?
Suddenly I have to lookup the real type in another header instead of being
told that it is an enum.  I see absolutely no gain from this procedure.
I'm not alone with my opinion; cf. the Linux style guide wrt typedeffing
struct names.

Also, the _t namespace is reserved by POSIX, this particular name would
invade it even more.

Diego


More information about the libdvdcss-devel mailing list