[U-Boot] Continuation line alignment

Gerlando Falauto gerlando.falauto at keymile.com
Tue Nov 8 11:20:47 CET 2011


On 11/08/2011 12:58 AM, Scott Wood wrote:
 > 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);
 > 	}

I like that too.

Anyway... Are there are any guidelines for indenting comments on the 
right side of the code? Like:

	if ((day_of_week() % 2 == 0 &&		/* even days are OK */
	     (temperature() < 14.4 || temperature() > 15.3)) ||
						/*
						 * but only outside of a
						 * certain temp. range
						 */
	    (sky_color() == E_BLUE && sim_credit() % 100 != 27) ||
						/*
						 * or, it's a nice a day
						 * but balance does not
						 * have 27 cents as
						 * decimal part
						 */
	    uptime() < 3600) {			/* work 4 the 1st hr! */
		work = 1;
	} else if ((received_calls() > 1 &&
		    zenith_angle() == 0) ||
		   call_is_important()) {
		work = 0;
	} else {
		udelay(rand());
		work = ((rand() % 2) == 1);
	}

... becuase git-gui will interpret all tabs which are on the right of 
some non-whitespace text in a very weird way.
Is using tabs on the right of text forbidden/not recommended for some 
reason?

Thanks!
Gerlando Falauto


More information about the U-Boot mailing list