Decrements what variable?
void editSetting(char *str, /* don't know what to put here */)
If it was my application, the first thing that I would do is evaluate that structure.Code: [Select] unsigned int channel : 4;You want to use half the storage that an unsigned int allocates, to hold a value. Hmmm, looks like a byte to me, and no reason to mess with bit fields....
unsigned int channel : 4;
QuoteI need to put together some of the most odd and obscure features of C.None of these is obscure or odd, and any good C reference or tutorial will tell you all you need to know.
I need to put together some of the most odd and obscure features of C.
The problem with bit-fields is that they may look like a neat way of mapping structures onto hardware registers or message formats, they're frequently not portable, because of endianness or memory alignment.
An BTW, why do you pass a string as first argument ?Code: [Select]void editSetting(char *str, /* don't know what to put here */)
c99 - Bit Fields.An implementation may allocate any addressable storage unit large enough to hold a bitfield. If enough space remains, a bit-field that immediately follows another bit-field in a structure shall be packed into adjacent bits of the same unit. If insufficient space remains, whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is implementation-defined. The order of allocation of bit-fields within a unit (high-order to low-order or low-order to high-order) is implementation-defined. The alignment of the addressable storage unit is unspecified.Also note that the standard says that a "bit-field shall have a type that is a qualified or unqualified version of int, unsigned int, or signed int", so having a bit-field in a char type is non-standard.
Paul, i think you're confusing nibbles (4bits) with bytes (8bits).