On Wed, Oct 27, 2010 at 03:42:53PM -0200, Thiago Farina wrote:
quoted text > On Wed, Oct 27, 2010 at 3:33 PM, Mark Brown
quoted text > > There is no reason to do this, logical values are treated as 0 and 1 in
> > C. Using false and true is clear and won't cause any difference in
> > code.
quoted text > In C99 I suppose that is true and legal?
Yes. C has always used 1 and 0 as the numerical mappings for logical
values, the addition of the keywords did not change them.
quoted text > >> Maybe like this?
> >> return (ret & info->mask) ? 1: 0;
quoted text > > No, that's needlessly obfuscated.
quoted text > Obfuscated? What you mean? It is a driver, and people reading and
> writing a driver would know what it means, no?
Adding the ternery operator just makes the code more noisy for no
benefit.
quoted text > Would be much simpler if it was just (like done in ab3100.c):
quoted text > return (ret & info->mask);
Yes, though there's no problem with the current code either.
--
unsubscribe notice To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Messages in current thread:
Re: [PATCH v2 1/2] regulator: add support for regulators o ... , Mark Brown , (Wed Oct 27, 10:56 am)