[Tinyos-devel] Combine function for bool
David Gay
dgay42 at gmail.com
Wed Apr 1 13:51:21 PDT 2009
On Wed, Apr 1, 2009 at 1:35 PM, Philip Levis <pal at cs.stanford.edu> wrote:
>
> On Apr 1, 2009, at 7:14 AM, Morten Tranberg Hansen wrote:
>
>> Hi all,
>>
>> Is there any specific reason for not having a combine function for
>> bool types defined in tos.h. If not, I suggest to add:
>>
>> typedef uint8_t bool @combine("bcombine");
>>
>> bool bcombine(bool b1, bool b2) @safe() {
>> return b1 && b2;
>> }
>>
>> Instead of just having:
>>
>> typedef uint8_t bool;
>
> I don't think bool has enough information: why is it && and not ||?
> For example, if I want to know whether everything is ready by calling
> some function called isReady(), I would want &&, but if I want to know
> if everything is ready by calling some function isBusy(), I would want
> ||. That is, which combine you want depends on the semantics of the
> function.
Define two new bool types with well-chosen names and leave 'bool' alone?
David
More information about the Tinyos-devel
mailing list