Statement terminators

usenet usenet at TSfR.UUCP
Tue May 9 19:35:04 AEST 1989


In article <13292 at lanl.gov> jlg at 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 at pell.uucp



More information about the Comp.lang.c mailing list