[Buildroot] Buildroot fails on powerpc with busybox login.c

Denis Vlasenko vda.linux at googlemail.com
Mon Sep 18 05:43:55 UTC 2006


On Sunday 17 September 2006 22:27, Bernhard Fischer wrote:
> >+#define LOGIN_OPT_f (1<<0)
> >+#define LOGIN_OPT_h (1<<1)
> >+#define LOGIN_OPT_p (1<<2)
> >
> >Defining constants using enum {...}; is saner.
> 
> Well, i find the defined constants more sane, but in the end, it's equal
> size. Still, note that code introspection tools will be cluttered with
> those enum's and that spoils the readability of the generated view, but
> that me be only just me disliking this mere minor detail.

#defines just look more familiar than enum {}. But #define has serious
flaws: it knows nothing about scope rules, and when you accidentally
#define name which is already used for something before or after
#define site, possibly inside another macro/#define
(for example: errno is a #define in glibc!), you get really obscure
compile errors. If you are lucky, that is. If you are not,
you get the most obscure bugs.

"enum { a = 1, b = 10 };" looks a bit ugly AT FIRST, while one
is not yet accustomized to parse them visually,
but has none of those "bug generator" properties.

"const a = 1;" is even better, but currently gcc+ld is not clever enough
to optimize it out completely.
--
vda



More information about the busybox mailing list