[Toybox] PM: code style, was: Re: New Subscriber

Frank Bergmann toybox at tuxad.com
Sun Feb 12 16:07:04 PST 2012


Hi,

On Sat, Feb 11, 2012 at 02:28:15PM -0600, Rob Landley wrote:
[...]
> execution units busy are much happier with:
>   x = 42;
>   if (blah) x = 37;
> Than with:
>   x = blah ? 42 : 37.

... at least it is better readable if you use this nice kernel macros
__likely() and unlikely(). ;-)

> Ah, alignment issues.

No! This was also my first thought. But I have alignments where they are
needed. A pre-allocated buffer of 1 MB seems to be too big for an AP7000
processor. :-)

> > Are you sure? For K&R I'm sure that it is but IMHO c99 "requires" the
> > usage of void in this case (using char** as char*).
> 
> Can you point me to where in the spec?

Did I wrote "IMHO"? ;-) K&R IMHO doesn't know anything about void. A
pointer char* was the universal pointer which may be "converted" (without
explicit casting) to any other pointer and vice versa. C99 (and the
standard before it) IMHO introduced void at least for this role. And IMHO
a non-explicit cast is only allowed for void* and not for char* anymore.

> http://landley.net/c99-draft.html

6.3.2.3 #1 describes the first part.
Maybe #7 may be interpreted as char* is not the "universal" pointer any
more.
sigh...

> He was conflating "sky" and the PDP-1 thing Slug Russell wrote.  Both of
> which are important in their own way...

Of course I know it. But Linus' research actually wasn't correct. :-)

Frank

-- 
EDV Frank Bergmann                           Tel.     05221-9249753
LPIC-3 Linux Professional                    Fax      05221-9249754
Pödinghauser Str. 5                          email    iservice at tuxad.com
32051 Herford                                USt-IdNr DE237314606



More information about the Toybox mailing list