Path: utzoo!mnetor!uunet!mcvax!tuvie!rcvie From: rcvie@tuvie (ELIN Forsch.z.) Newsgroups: comp.lang.c Subject: Re: Some possible deficiencies in dpANS (or whatever its called) Message-ID: <559@tuvie> Date: 19 Jan 88 15:10:42 GMT References: <4755@tut.cis.ohio-state.edu! Reply-To: rcvie@tuvie.UUCP (Alcatel-ELIN Forsch.z.) Organization: Technical University of Vienna Lines: 46 Keywords: none Summary: It may be perfectly all right! In article <4755@tut.cis.ohio-state.edu! lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes: !I was looking over the Oct '86 draft and noticed a couple of !things I believe are deficiencies. If these have been corrected !then n this posting. ! !1) In the definition of statement (section 3.6) one of the legal !forms of statement is the expression and null statement (section !3.6.3). The syntax is: ! ! expression-statement: ! expression ; ! opt ! !Looking at the definitions of the various types of expressions !it looks like the following are valid *statements*: ! ! i; ! j << 2; ! k == 0; ! "hello world\n"; ! !I believe this is a deficiency. These statements have no effect !(other than eating a machine cycle which might be desired I guess), !and in fact lint flags them. This is related to the "language !induced errors" discussion recently. The programmer probably !meant to write: ! ! i++; /* or something similar */ ! j <<= 2; ! k = 0; ! p = "hello world\n"; /* or something similar */ ! !If the current draft allows these null effect statements (other !than the null statement) please consider disallowing them. Please !mail me an address to write to so I may raise this objection. ! C was designed as a system programmer's language! For these people it may be very important to change the status of a register, flag, or whatever by evaluating an expression whithout assigning its value anywhere (which might change the flag, register, ... again). Good compilers, however, will produce a warning like "Expected side effects" or whatever. But allowing this syntax is certainly no deficiency. Dietmar Weickert, ALCATEL-ELIN Research Center, Vienna, Austria.