[sdiy] Quick C query

Neil Johnson neil.johnson97 at ntlworld.com
Sun Nov 21 17:17:51 CET 2010


Hi Tom,

> What's the best way to deal with booleans in C?

What is it that you are trying to do?  Do you have individual boolean  
values that you are looking for efficient storage?  Do you have  
complicated expressions that you want to simplify?

Some example code would help.

Thing is with C, there are so many ways to do things it all really  
depends on the specific application.

> I see that we don't have a Boolean type explicitly.

Indeed not, as the original machines that C was designed for did not  
have boolean operators (other than conditional branching and the Zero  
flag).

> Presumably there's a standard practice for this, since I'm not the  
> first person to need a boolean.

The are *standards* - plural.  As I say it really depends on what you  
want to achieve.

> If it makes any odds, I'm using Microchip's C Lite on dsPIC.

Does that have any target-specific or vendor-specific extensions?

> PS: Neil - frustrations aside, I'll stick at it!

Once you see the light you'll wonder why you never jumped before!!!

Cheers,
Neil
--
http://www.njohnson.co.uk






More information about the Synth-diy mailing list