From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Mon, 7 Nov 2011 17:58:05 -0600 Subject: [U-Boot] Continuation line alignment In-Reply-To: <4EB86AA8.30901@keymile.com> References: <1319647072-17504-1-git-send-email-gerlando.falauto@keymile.com> <1319647072-17504-2-git-send-email-gerlando.falauto@keymile.com> <20111105160958.F40D11893014@gemini.denx.de> <4EB84859.6000906@keymile.com> <20111107220505.E5386189301B@gemini.denx.de> <4EB86384.7010409@freescale.com> <4EB86AA8.30901@keymile.com> Message-ID: <4EB8708D.1050405@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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