return expr and Decus-C

Martin Minow minow at decvax.UUCP
Sat May 5 07:59:52 AEST 1984


Previously, on net.lang.c, the following was stated:

1.  Decus C does not support "return expression;" where the
    expression is not enclosed in parentheses.

2.  Decus C predates Kernighan and Ritchie, where the parentheses
    were shown as optional.

3.  Version 6 Unix C compilers accepted this syntax before
    before of Kernighan and Ritchie.

These statements are true.  However, Decus C was coded using the
Unix Version 6 reference manual, where the only valid forms for the
return statement were

	return
and	return ( expression )

Since the person who wrote Decus C did not have access to the
source code for Unix C, he had no way of knowing that the syntax
accepted by the compiler did not agree with the reference manual.

We have not bothered to change Decus C as we feel that we would be
legitimizing a poor programming practice.  The change to the compiler,
which is very simple, is left as a exercise for the student.


Martin Minow
decvax!minow



More information about the Comp.lang.c mailing list