On Tue, 27 Oct 2009, Rob Landley wrote:

On Mon, 26 Oct 2009, Rob Landley wrote:
... Also, in my experience _Bool is about as real-world useful as the
bit field notation with the colons, and is really there to keep the
language pedants and the c++ guys happy without actually accomplishing
much.  I've never seen it actually produce better code.

It can produce more readable, less error-prone C code though. We use
hardware register definitions such as

typedef struct {
   unsigned int x : 8;
   unsigned int y : 8;
   unsigned int control_bit : 1;
   unsigned int dummy1  : 15;
} reg_foo;

at great length for the C definitions for the registers in our chips, and
it really does avoid nasty errors that crop up when using shifting and
masking.

And introduces new nasty errors when "unspecified by the standard" details such
as endianness change.
[ ... ]
You're fine if all the world's a VAX, but uClibc, busybox, and the Linux kernel
tend to like working on things like powerpc and mips.

You're right, probably not useful in the general case, I was really commenting on the 'without actually accomplishing much' bit. In the case of a specific processor or system-on-chip endianess doesn't change and often the same compiler is used at all times. I'd agree there might be
issues for a general piece of software, such as uClibc.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to