On Fri, Jan 29, 2010 at 7:11 PM, Michael Schwingen
<rincew...@discworld.dascon.de> wrote:
> Andreas Fritiofson wrote:
>> This would help to avoid picking a magic value for true.
>> #define false 0
>> #define true (!false) // this will actually evaluate to 1
>>
> IMHO, this is unnecessary obfuscation.
> The C standard guarantees that this will evaluate to 1, so why not write
> 1 directly?
>

To signal to less knowledgeable people, who might be reading/altering
the code, that it is *not* an arbitrary value. You are probably less
likely to change the definition of "true" from "not false" than from
"1" to another non-zero value which might seem just as valid but which
isn't, such as "-1".

Just my 0.14772 SEK...

A bit more on-topic:
Doesn't clang have stdbool.h? It should provide these constants
already. For systems lacking stdbool.h, OpenOCD already contains the
necessary compatibility defines in types.h, isn't that getting
included?
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to