[sdiy] Quick C query

Thomas Strathmann thomas at pdp7.org
Sun Nov 21 14:37:14 CET 2010


On 11/21/10 14:31 , Tom Wiltshire wrote:
> What's the best way to deal with booleans in C? I see that we don't have a Boolean type explicitly.
> Presumably there's a standard practice for this, since I'm not the first person to need a boolean.

If you just need one or two boolean variables use something like char 
which has only 8 bits usually. If you need whole arrays of boolean 
variables you'll want to look into bit manipulation to adress each bit 
individually or try out what the compiler does with bit fields.

I think http://en.wikipedia.org/wiki/Bit_field has a fairly good discussion.

	Thomas



More information about the Synth-diy mailing list