Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdahl!pacbell!att!ihlpb!TSfR!usenet From: usenet@TSfR.UUCP (usenet) Newsgroups: comp.lang.c Subject: Re: Statement terminators Summary: escaped newlines == all sorts of fun little logic bugs Message-ID: <542@TSfR.UUCP> Date: 9 May 89 09:35:04 GMT References: <2296@mit-caf.MIT.EDU> <13292@lanl.gov> Reply-To: orc@pell.UUCP (David L. Parsons) Followup-To: comp.lang.c Organization: Multi-stadel in '89 Lines: 44 Expires: In article <13292@lanl.gov> jlg@lanl.gov (Jim Giles) writes: > In fact, almost everyone >begins each program statement on a separate line. When rotating an argument list, I use the form ++argv; --argc; /* some descriptive comment */ This is a good way of showing that those two statements should be considered as one thing. splitting them over two lines makes them blend in with the rest of the code, so I need to stuff extra comments and whitespace around them to make them stand out. And, of course, when they are split onto different lines, they become vulnerable to continental drift. >The _less_ common usage (by a _long_ shot) is continuation of statements ^^^^^^^^^^^^^^^^ Not in the code I work with... >across lines - it is _this_ case that should have the extra syntax of >an escaped carriage return. Which, if you miss it, can lead to all sorts of hard-to-find problems if you're using a language which is as rich as C. For example: pointer_expression_one = (complex_pointer_expression_2) -(complex_scalar_expression) Leave the escape off the first line and you've got two valid statements. With (for example) C, leave the semicolin off the second line and you've got error messages. The problem with escaping newlines on continuations is that it's easier to forget what you're doing when you have to do extra work in rare special cases. If you have to tell the compiler that you are ending _every_ statement, you're less likely to forget it where it's important. (How many times to C programmers forget the semicolins on statements as opposed to the number of times pascal programmers forget to _not_ put semicolins on the `special' statement blocks...?) -david parsons -orc@pell.uucp