Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!ukma!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c Subject: A brace vs. indentation hypothesis (was Re: Braces are not Compiler-Fluff.) Message-ID: <305@twwells.uucp> Date: 8 Jan 89 07:07:46 GMT References: <272@twwells.uucp> <849@unh.UUCP> <292@twwells.uucp> <196@mstan.Morgan.COM> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 69 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <196@mstan.Morgan.COM> dff@Morgan.COM (Daniel F. Fisher) writes: : Thus, I find " : : if ((p != (struct foo *)(0)) : && (p->barp != (struct bar *)(0)) : && (p->barp->type == BAR_BAZ_TYPE)) : { : debazify(p->barp); : saltpork(p); : } : : " more readable than " : : if ((p != (struct foo *)(0)) : && (p->barp != (struct bar *)(0)) : && (p->barp->type == BAR_BAZ_TYPE)) { : debazify(p->barp); : saltpork(p); : } : Agreed, but I find this even more readable: if (p != 0 && p->barp != 0 && p->barp->type == BAR_BAZ_TYPE) { debazify(p->barp); saltpork(p); } or, if I were in an extravagant mood: if (p != 0 && p->barp != 0 && p->barp->type == BAR_BAZ_TYPE) { debazify(p->barp); saltpork(p); } or, possibly: if ( p != 0 && p->barp != 0 && p->barp->type == BAR_BAZ_TYPE) { debazify(p->barp); saltpork(p); } Note the eight column indentation for control structure. I can then use any indentation from two to six for continuation of the expression; more than enough space and flexibility to make things stand out well. Thus I don't care about the braces. Here's a hypothesis: there is a relationship between peoples' preference for brace placement and the amount of space they use for indentation. My belief is that the narrower the indentation, the greater the perceived need to make braces visible; the wider the indentation, the greater the desire to get those pesky things out of the way. So, let's have a poll: 1) The number of spaces I indent is: ___ [columns] 2) The braces are important for following the control structure or setting it off: ___ [yes/no] Anyone who would like to respond, send to me at the address below. I'll summarize the responses in a few days. --- Bill { uunet!proxftl | novavax } !twwells!bill