[U-Boot] Continuation line alignment
Scott Wood
scottwood at freescale.com
Tue Nov 8 00:58:05 CET 2011
On 11/07/2011 05:32 PM, Gerlando Falauto wrote:
> What bothers me more is, for instance, the condition under which my
> smartphone will work correctly:
>
> if (((day_of_week() % 2 == 0) &&
> (temperature() < 14.4 || temperature() > 15.3))
> || ((sky_color() == E_BLUE) && (sim_credit() % 100 != 27))
> || (uptime() < 3600) ) {
> work = 1;
> } else if ( ((received_calls() > 1) &&
> (zenith_angle() == 0))
> || (call_is_important())
> ) {
> work = 0;
> } else {
> udelay(rand());
> work = ((rand() % 2) == 1);
> }
I like aligning based on which level of nested parens the line break is
in (and removing unnecessary parens when precedence is obvious, to make
it easier to track the relevant ones):
if ((day_of_week() % 2 == 0 &&
(temperature() < 14.4 || temperature() > 15.3)) ||
(sky_color() == E_BLUE && sim_credit() % 100 != 27) ||
uptime() < 3600) {
work = 1;
} else if ((received_calls() > 1 &&
zenith_angle() == 0) ||
call_is_important()) {
work = 0;
} else {
udelay(rand());
work = ((rand() % 2) == 1);
}
-Scott
More information about the U-Boot
mailing list