svn commit: trunk/busybox/shell

Mike Frysinger vapier at gentoo.org
Sun Apr 15 10:18:53 UTC 2007


On Saturday 14 April 2007, Denis Vlasenko wrote:
> -Exceptions:
> -
> - - if you have long logic statements that need to be wrapped, then
> uncuddling -   the bracket to improve readability is allowed:
> +If you have long logic statements that need to be wrapped, then uncuddling
> +the bracket to improve readability is allowed. Generally, this style makes
> +it easier for reader to notice that 2nd and following lines are still
> +inside 'if':
>
> -		if (some_really_long_checks && some_other_really_long_checks \
> -		    && some_more_really_long_checks)
> -		{
> +		if (some_really_long_checks && some_other_really_long_checks
> +		 && some_more_really_long_checks
> +		 && even_more_of_long_checks
> +		) {

personally i think the former is better than the latter as my eyes tend to 
pick out the scope brackets {} rather than function/grouping parens ()

> +Labels
> +~~~~~~
> +
> +Labels should start at the beginning of the line, not indented to the
> block +level (because they do not "belong" to block scope, only to whole
> function). +
> +	if (foo) {
> +		stmt;
> + label:
> +		stmt2;
> +		stmt;
> +	}
> +
> +(Putting label at position 1 prevents diff -p from confusing label for
> function +name, but it's not a policy of busybox project to enforce such a
> minor detail).

ah, this subtle diff behavior is quite good to know ... in that case, i can 
see the value in having it spaced by one ...

> +Then have long options defined:
> +
> +	static const struct option <applet>_long_options[] = {
> +		{ "list",    0, NULL, 't' },
> +		{ "extract", 0, NULL, 'x' },
> +		{ NULL }
> +	};

i want to say { NULL, 0, NULL, 0 } prevents warnings that { NULL } causes, but 
i could just be pulling this out of my ass ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070415/e84e76bd/attachment-0002.pgp 


More information about the busybox mailing list