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

2005-07-11 Thread Roman Zippel
Hi, On Mon, 11 Jul 2005, Horst von Brand wrote: > > I don't generally disagree with that, I just think that defines are not > > part of that list. > > Covered in "bad coding style" and "hard to read code", at least. Somehow I missed the last lkml debate about where simple defines where a prob

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

2005-07-11 Thread Horst von Brand
Roman Zippel <[EMAIL PROTECTED]> wrote: > On Sun, 10 Jul 2005, Pekka Enberg wrote: [...] > > Would you please be so kind to define your criteria for things that > > "need fixing" so we could see if can reach some sort of an agreement on > > this. My list is roughly as follows: > > > > - Errone

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

2005-07-11 Thread Horst von Brand
Vojtech Pavlik <[EMAIL PROTECTED]> wrote: > On Sun, Jul 10, 2005 at 09:21:42PM +0300, Pekka Enberg wrote: > > Hmm. So we disagree on that issue as well. I think the point of review > > is to improve code and help others conform with the existing coding > > style which is why I find it strange that

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

2005-07-10 Thread Pekka J Enberg
Hi Roman, Roman Zippel writes: I don't generally disagree with that, I just think that defines are not part of that list. They're in Documentation/CodingStyle (see Chapter 11). Roman Zippel writes: Look, it's great that you do reviews, but please keep in mind it's the author who has to wo

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

2005-07-10 Thread Pavel Machek
Hi! > >>enums in C are (de?)promoted to integral types under most conditions, so > >>the type-checking is useless. > > > > > >It's a warning in gcc afaik and spare should complain as well. > > Check again. Check sparse with -Wbitwise and enum properly marked as bitwise...

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

2005-07-10 Thread Vojtech Pavlik
On Sun, Jul 10, 2005 at 09:21:42PM +0300, Pekka Enberg wrote: > Hmm. So we disagree on that issue as well. I think the point of review > is to improve code and help others conform with the existing coding > style which is why I find it strange that you're suggesting me to limit > my comments to a

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

2005-07-10 Thread Roman Zippel
Hi, On Sun, 10 Jul 2005, Pekka Enberg wrote: > > The point of a review is to comment on things that _need_ fixing. Less > > experienced hackers take this a requirement for their drivers to be > > included. > > Hmm. So we disagree on that issue as well. I think the point of review > is to impro

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

2005-07-10 Thread randy_dunlap
On Sun, 10 Jul 2005 21:21:42 +0300 Pekka Enberg wrote: | Hi Roman, | | At some point in time, I wrote: | > > Roman, it is not as if I get to decide for the patch submitters. I | > > comment on any issues _I_ have with the patch and the authors fix | > > whatever they want (or what the maintainers

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

2005-07-10 Thread Pekka Enberg
Hi Roman, At some point in time, I wrote: > > Roman, it is not as if I get to decide for the patch submitters. I > > comment on any issues _I_ have with the patch and the authors fix > > whatever they want (or what the maintainers ask for). On Fri, 2005-07-08 at 21:59 +0200, Roman Zippel wrote: >

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

2005-07-10 Thread Denis Vlasenko
On Friday 08 July 2005 19:57, Roman Zippel wrote: > Hi, > > On Fri, 8 Jul 2005, Bryan Henderson wrote: > > > I wasn't aware anyone preferred defines to enums for declaring enumerated > > data types. > > If it's really enumerated data types, that's fine, but this example was > about bitfield ma

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

2005-07-08 Thread Pekka Enberg
Hi, On Fri, 2005-07-08 at 21:11 +0200, Roman Zippel wrote: > So it basically comes down to personal preference, if the original uses > defines and it works fine, I don't really see a good enough reason to > change it to enums, so please leave the decision to author. (And I don't see a good enou

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

2005-07-08 Thread Bryan Henderson
>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 enumeration

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

2005-07-08 Thread Mike Waychison
Wichert Akkerman wrote: Previously Mike Waychison wrote: enums in C are (de?)promoted to integral types under most conditions, so the type-checking is useless. It's a warning in gcc afaik and spare should complain as well. Check again. You must be thinking of another language. Show me h

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

2005-07-08 Thread Roman Zippel
Hi, On Fri, 8 Jul 2005, Pekka Enberg wrote: > On Fri, 2005-07-08 at 21:11 +0200, Roman Zippel wrote: > > So it basically comes down to personal preference, if the original uses > > defines and it works fine, I don't really see a good enough reason to > > change it to enums, so please leave the

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

2005-07-08 Thread Ram
On Fri, 2005-07-08 at 12:11, Roman Zippel wrote: > Hi, > > On Fri, 8 Jul 2005, Pekka J Enberg wrote: > > > 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 ident

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

2005-07-08 Thread Roman Zippel
Hi, On Fri, 8 Jul 2005, Pekka J Enberg wrote: > 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. So it basically comes down to p

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

2005-07-08 Thread Pekka J Enberg
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 beca

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

2005-07-08 Thread Wichert Akkerman
Previously Mike Waychison wrote: > enums in C are (de?)promoted to integral types under most conditions, so > the type-checking is useless. It's a warning in gcc afaik and spare should complain as well. Wichert. -- Wichert Akkerman <[EMAIL PROTECTED]>It is simple to make things. http://www

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

2005-07-08 Thread Mike Waychison
Wichert Akkerman wrote: Previously Bryan Henderson wrote: Two advantages of the enum declaration that haven't been mentioned yet, that help me significantly: There is another one: with enums the compiler checks types for you. enums in C are (de?)promoted to integral types under most condi

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

2005-07-08 Thread Wichert Akkerman
Previously Bryan Henderson wrote: > Two advantages of the enum declaration that haven't been mentioned yet, > that help me significantly: There is another one: with enums the compiler checks types for you. Wichert. -- Wichert Akkerman <[EMAIL PROTECTED]>It is simple to make things. http://

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

2005-07-08 Thread Bryan Henderson
>If it's really enumerated data types, that's fine, but this example was >about bitfield masks. 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. The proper way

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

2005-07-08 Thread Roman Zippel
Hi, On Fri, 8 Jul 2005, Bryan Henderson wrote: > I wasn't aware anyone preferred defines to enums for declaring enumerated > data types. If it's really enumerated data types, that's fine, but this example was about bitfield masks. > Isn't the only argument for defines, "that's what I'm used t

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

2005-07-08 Thread Bryan Henderson
I wasn't aware anyone preferred defines to enums for declaring enumerated data types. The practical advantages of enums are slight, but as far as I know, the practical advantages of defines are zero. Isn't the only argument for defines, "that's what I'm used to."? Two advantages of the enum d