[coreboot] RFC: coding style: "standard" defines

Nico Huber nico.h at gmx.de
Thu Feb 4 23:00:31 CET 2016


On 04.02.2016 22:25, Patrick Georgi via coreboot wrote:
> 2016-02-04 22:22 GMT+01:00 Martin Roth <gaumless at gmail.com>:
>> I don't think we need redefinitions of TRUE/FALSE
> We have no canonical definitions for TRUE/FALSE right now.
> Contributions that use them (for whatever reason) tend to bring local
> copies, and that's what I'd like to avoid.
I don't like true/false definitions neither. If we have contributions
which bring them, well, we should factor it out during review.

Arguments against true/false definitions? It's C! As we know, in C,
everything but 0 is naturally true. While redefining true/false seems
to enhance readability, it breaks with this principle. That might not
be a problem if you write new code---you usually know how you want to
interpret true then. However if you just read code you might find a
condition like
  if (something == true)
So, I expect that this comparison is done in terms of the type of
`something` (and is only "true" if `something` evaluates to 1). Is it
like that? Well, I'm pretty sure it is. But having to think about it
is already too much IMO.

Nico



More information about the coreboot mailing list