Re: share/private/slave a subtree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 8 Jul 2005, Pekka J Enberg wrote:
> Hey, I just review patches. I don't get to set requirements. There's a reason
> why enums are preferred though. They define a proper name for the constant.

Roman Zippel writes:
Who prefers that?

Well, me, at least. I can't speak for others.
On Fri, 8 Jul 2005, Pekka J Enberg wrote:
> It's far to easy to mess up with #defines.

Roman Zippel writes:
Rather unlikely with such simple masks.

Redefining a constant with #define by an accident is easy. Introducing duplicate constants is equally easy (see radeon headers for an example).
On Fri, 8 Jul 2005, Pekka J Enberg wrote:
> They also document the code intent
> much better as you can group related constants together.

Roman Zippel writes:
You can't do that with defines?

Sure you can but have you ever tried to figure out where a group of #define enumerations end? Enums are a natural language construct for grouping related constants so why not use it? Bottom line, there are few advantages to using enums rather than #defines which is why they are IMHO preferred for new code. Pekka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux