Re: share/private/slave a subtree - define vs enum

From: Bryan Henderson
Date: Fri Jul 08 2005 - 18:23:47 EST


>I don't see how the following is tortured:
>
>enum {
> PNODE_MEMBER_VFS = 0x01,
> PNODE_SLAVE_VFS = 0x02
>};

Only because it's using a facility that's supposed to be for enumerated
types for something that isn't. If it were a true enumerated type, the
codes for the enumerations (0x01, 0x02) would be quite arbitrary, whereas
here they must fundamentally be integers whose pure binary cipher has
exactly one 1 bit (because, as I understand it, these are used as bitmasks
somewhere).

I can see that this paradigm has practical advantages over using macros
(or a middle ground - integer constants), but only as a byproduct of what
the construct is really for.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/