Messages in this thread |  | | Date | Mon, 16 Oct 2000 16:47:09 -0400 (EDT) | From | Alexander Viro <> | Subject | Re: Patch to remove undefined C code |
| |
On 16 Oct 2000, Ben Pfaff wrote:
> Jonathan George <Jonathan.George@trcinc.com> writes: > > > This patch has many bogus corrections where new variables were created, but > > the order of evaluation is already unambiguous. > > > > For example each comma separated clause in an expression is guaranteed to be > > completely evaluated before the next comma separated clause Including > > Assignments. > > No, that is not true in general. When the comma in question is > the comma operator, it is true. But when the comma separates > arguments to a function, it is not: the order of evaluation of > function arguments is implementation dependent. See C89 section > 6.3.2.2 "Function calls": [snip]
No arguments here, but proposed fixes were remarkably ugly. Example:
tmp = *p++; *q = f(tmp, *p++); return p;
is equivalent to more idiomatic
*q = f(p[0], p[1]); return p+2;
And example with copying the string up to the comma... Yuck. Legal C != decent C.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |