Proposal for a scientific look at C style choices

David Dyer-Bennet ddb at ns.UUCP
Thu Jan 12 08:32:00 AEST 1989


In article <138 at mole-end.UUCP> mat at mole-end.UUCP (Mark A Terribile) writes:
:> 
:>     if (((a->op == XNES_step) && (a->size <= XNES_bufsize)) ||
:>       ((a->op == XNES_fix) && ((a->size + a->leftover) <= XNES_bufsize))) {
:> 	/* code */
:>     }
:> For a more complex expression I would tend to indent blocks as indicated
:> by the parenthasization of the expression.
:
:Indenting isn't a bad idea.  But is it a good idea to use so many redundant
:parens?  When I put parens in, I *mean* them to be there; I *mean* that the
:normal, usually correct (ok, except for bitops .vs. relops and equops)
:precedence is violated; in their absence, default thinking and default
:perception will do just fine.

I'm slightly confused here; I believe the parens above are all copied verbatim
from your example.  Only the whitespace has been changed.

:Do you *really* want to bury the conjuntive/disjuntive operators at the
:end or in the middle of the line? 

Yes, definitely.  For the same reason you want to put them elsewhere:  more
readable.  I dislike leaving a line-end that looks like a statement end
(not being good at parsing ";" mentally), so I try to end a continued
expression line with an operator.  After all, they are infix operators, so
they're going to be infixed most of the time anyway; I've just gotten used
to looking for them there.

 
-- 
	-- David Dyer-Bennet
	...!{rutgers!dayton | amdahl!ems | uunet!rosevax}!umn-cs!ns!ddb
	ddb at Lynx.MN.Org, ...{amdahl,hpda}!bungia!viper!ddb
	Fidonet 1:282/341.0, (612) 721-8967 hst/2400/1200/300



More information about the Comp.lang.c mailing list