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

Rich Felker dalias at aerifal.cx
Mon Sep 18 07:06:20 UTC 2006


On Mon, Sep 18, 2006 at 07:43:55AM +0200, Denis Vlasenko wrote:
> 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

This is not glibc being stupid; it's required for doing threads in the
C language (__thread is not part of C) and obviously sanctioned by ISO
C and POSIX.

> "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.

Next time I see someone using the name "LOGIN_OPT_h" for another
purpose I'll let you know.....

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

If the const variable is not static there is no way to optimize it
out. It could be modified from another module (C does not have true
constant variables) afaik. ld can't change the machine code at link
time.. :)

Rich




More information about the busybox mailing list