[U-Boot] [PATCH v0 1/4] Groundwork for generalization of env interface

Wolfgang Denk wd at denx.de
Tue Nov 8 00:30:54 CET 2011


Dear Gerlando Falauto,

In message <4EB86424.7000508 at keymile.com> you wrote:
>
> > http://www.denx.de/wiki/U-Boot/CodingStyle:
> >
> > 	Use TAB characters for indentation and vertical alignment, not
> > 	spaces
> 
> That's exactly what you told me in your reply, and doesn't answer my 
> question.

Sory, but I don;t know how else to put it.

> The only way I could think of to achieve vertical alignment in a complex 
> if statement without recurring to spaces is by adding extra tabs between 
> parentheses, with an enormous waste of space.

In the first step you should try and avoid complex if statements.

> Your answer might as well be: "forget about alignment altogether, nobody 
> wants that, just indent it somehow".
> 
> >> +	if (himport_ex(&env_htab, (char *)default_environment,
> >> +		    sizeof(default_environment), '\0', 0,
> >> +		      0, NULL, apply_function) == 0) {
> >>
> >> What should be the right indentation?
> >
> > In any case it makse no sense to have the 2nd and 3rd line indented
> > differently, right?
> 
> That's absolutely right.
> Once again, though, you did not help me understand what The Right Thing 
> (tm) is. I also made a shy attempt, but you're not telling me whether 
> it's good or not.
> It's hard to follow some guidelines when they're not clearly stated.

Well, my suggestion is to align by TABs:

	if (himport_ex(&env_htab, (char *)default_environment,
			sizeof(default_environment), '\0', 0,
			0, NULL, apply_function) == 0) {
		...
	}

Yes, the 's' and the '0' don't start exactly below the '&'.  But who
says they should?  We also don't align the closing ')' below the
opeing '(' ...

And does above code look difficult to read? 

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The optimum committee has no members.
                                                   - Norman Augustine


More information about the U-Boot mailing list