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

From: Pekka J Enberg
Date: Fri Jul 08 2005 - 13:22:09 EST


Roman Zippel writes:
> If it's really enumerated data types, that's fine, but this example was > about bitfield masks.

Bryan Henderson writes:
Ah. In that case, enum is a pretty tortured way to declare it, though it does have the practical advantages over define that have been mentioned because the syntax is more rigorous.

I think the bit we're talking about is this:

Index: 2.6.12/fs/pnode.c
===================================================================
--- /dev/null
+++ 2.6.12/fs/pnode.c
@@ -0,0 +1,362 @@
+
+#define PNODE_MEMBER_VFS 0x01
+#define PNODE_SLAVE_VFS 0x02

I don't see how the following is tortured:

enum {
PNODE_MEMBER_VFS = 0x01,
PNODE_SLAVE_VFS = 0x02
};

In fact, I think it is more natural. An almost identical example even appears in K&R.

Pekka

-
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/