svn commit: trunk/busybox/util-linux

Denis Vlasenko vda.linux at googlemail.com
Tue Sep 19 17:00:04 UTC 2006


On Tuesday 19 September 2006 18:30, Jason Schoon wrote:
> > > >> -#define useMtab 0
> > > >> -#define fakeIt 0
> > > >> +enum {
> > > >> +  useMtab = 0,
> > > >> +  fakeIt = 0,
> > > >> +};
> > > >
> > > >Ok, your argument a moment ago in favor of using enum was scoping
> > rules, and
> > > >here you're making a global enum.
> > > >
> > > >Anybody else see an inconsistency here?
> > >
> > > I don't like these enums. IMHO they are not readable and -- compared to
> > > defines -- don't come with any advantage whatsoever.
> >
> > Okay, let's say you do
> >
> > #define linenumber 0
> >
> > What will happen if somebody, somewhere in the jungle of included
> > header files, already used "linenumber" as a name for something?
> >
> > With enum, you'll get understandable error message.
> 
> 
> Umm, with lint for certain, and I thought with most newer compilers, you
> will get a "linenumber redefined" type of message.

Only if linenumber was a #define. It is was a variable/function/typedef,
you get no warning.
--
vda



More information about the busybox mailing list