Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jul 2001 18:15:09 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Paul Richards <paul@freebsd-services.co.uk>
Cc:        Ruslan Ermilov <ru@FreeBSD.org>, Bruce Evans <bde@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/share/man/man9 style.9
Message-ID:  <Pine.BSF.4.21.0107221746120.24145-100000@besplex.bde.org>
In-Reply-To: <517230000.995763034@lobster.originative.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 22 Jul 2001, Paul Richards wrote:

> >> What I was talking about was:
> >> 		if (mylevel == SLC_DEFAULT) {
> >> 			slctab[(int)func].current.flag = flag;
> >> 			slctab[(int)func].current.val = val;
> >> 			flag |= SLC_ACK;
> >> 		} else if (hislevel == SLC_CANTCHANGE &&
> >> 		    mylevel == SLC_CANTCHANGE) {
> 
> Why is this good style?

Because it gives uniform indentation which is never >= the next full
indentation level (== is especially hard to read).

> I find that much harder to read than the case where the tests are lined up
> i.e.
> 
> } else if (hislevel == SLC_CANTCHANGE &&
>            mylevel == SLC_CANTCHANGE) {

Everything is easier to read when it is outdented to column 0 and complicated
surrounding context is removed :-).  A real example would look more like:

		if (foo(verylongarg1, verylongarg2, verylongarg3) ==
			SLC_CANTCHANGE) {
			flag |= SLC_ACK;
		} else if (thisfunctionnameistoolongforitsowngood(arg1,
								  arg2) == 1) {
			flag |= SLC_AGH;
		} else if (hislevel == SLC_CANTCHANGE &&
			   mylevel == SLC_CANTCHANGE) {
			slctab[(int)func].current.flag = flag;
		}

(More normal examples would start in column 48 and not need such long
names to be so ugly.).

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0107221746120.24145-100000>