Quick and dirty malloc() support for realpath.
Chris Gray
chris.gray at kiffer.be
Tue Oct 27 17:46:19 UTC 2009
On Tuesday 27 October 2009 08:54:50 Ricard Wanderlof wrote:
> 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.
I gave up on bitfields the day I ran something like that through two compilers
and one decided that x was "obviously" the high-order byte of the word and the
other decided it was "obviously" the low-order one. Oh yes and they made
opposite decisions about signedness too, but at least you can control that (as
in your example). So now I just write little inlined functions or macros to do
the manipulations.
Just another other opinion. ;->
Chris
--
Chris Gray /k/ Embedded Java Solutions BE0809.435.306
Embedded & Mobile Java, OSGi http://www.k-embedded-java.com/
chris.gray at kiffer.be +32 3 216 0369
More information about the uClibc
mailing list