From: Denis Vlasenko Subject: Re: share/private/slave a subtree - define vs enum Date: Sun, 10 Jul 2005 13:55:33 +0300 Message-ID: <200507101355.33338.vda@ilport.com.ua> References: Mime-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Cc: Andrew Morton , bfields@fieldses.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linuxram@us.ibm.com, mike@waychison.com, Miklos Szeredi , Pekka J Enberg , Alexander Viro Return-path: Received: from 167.imtp.Ilyichevsk.Odessa.UA ([195.66.192.167]:5804 "HELO port.imtp.ilyichevsk.odessa.ua") by vger.kernel.org with SMTP id S261888AbVGJKzo (ORCPT ); Sun, 10 Jul 2005 06:55:44 -0400 To: Roman Zippel , Bryan Henderson In-Reply-To: Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 masks. > > > Isn't the only argument for defines, "that's what I'm used to."? > > defines are not just used for constants and there is _nothing_ wrong with > using defines for constants. Apart from the wart that defines know zilch about scopes. Thus completely fine looking code will give you atrociously obscure compiler message. Real world example for userspace: # cat t.c #include #include void f() { char errno[] = "hello world"; puts(errno); } # gcc -c t.c t.c: In function `f': t.c:5: error: function `__errno_location' is initialized like a variable t.c:5: error: conflicting types for '__errno_location' /usr/include/bits/errno.h:38: error: previous declaration of '__errno_location' was here -- vda