Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site umd5.UUCP Path: utzoo!linus!decvax!genrad!panda!talcott!harvard!seismo!umcp-cs!cvl!umd5!zben From: zben@umd5.UUCP Newsgroups: net.lang.c Subject: Re: C bites / programming style Message-ID: <735@umd5.UUCP> Date: Fri, 6-Sep-85 22:11:27 EDT Article-I.D.: umd5.735 Posted: Fri Sep 6 22:11:27 1985 Date-Received: Tue, 10-Sep-85 21:01:27 EDT References: <418@phri.UUCP> <700002@fthood> <209@3comvax.UUCP> Reply-To: zben@umd5.UUCP (Ben Cranston) Organization: U of Md, CSC, College Park, Md Lines: 40 Summary: Yet another indenting style In article <209@3comvax.UUCP> mikes@3comvax.UUCP (Mike Shannon) writes: >With regard to changing > if(condition) { | if(condition) > s1; into { > s2; | s1; > } | s2; > | } >[the idea is to indent the braces so that they are in the same column as > the statements they enclose] Actually, I prefer: if (condition) { s1; s2; } If I had to rationalize, I would say that the { and } are intermediate in level between the mainline code and the controlled statements, and that their indenting reflects this intermediate status. Also, you can draw lines on the listing between the brackets and manually verify nesting status. This seems very useful, as the C compilers I have used don't seem to be very good at giving meaningful diagnostics in this case. (Can you say "pathological"? I *knew* you could!) Also note, indent by one and then two, so each level of indenting takes only three columns. This means you can program a more complicated routine before you start running out of space on the right. You shouldn't be programming routines that are that complex? Silly person, this is C! Any language in which *(*(*(*(*(int ()(*)()(*)))))) is a legal declaration can't put much emphasis on clarity, can it? (I know, religious statement...). Guess it's a good thing my terminal doesn't do tabs, or I would be locked into that silly "every 8" standard and writing twice as many functions as I had to... -- Ben Cranston ...{seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben zben@umd2.ARPA