RE: w3c-libwww-5.2.8-7 bug report

Hmmm... Don't want to get into a long drawn out discussion on this but
I don't get why you "concluded" that "i = ++i;" is undefined in K&R "C".
I have the Kernighan an Ritchie book sitting in front of me and it does
describe what would happen with the expression "x = ++i;" and "x = i++;".
In the lexical language reference of K&R "C" in the same book it does
not care what is on the left of the "=" operator during the right hand
evaluation.  It should not care either since it is always performed
after the expression on the right is evaluated. The expression "x = ++x;"
is the same as "x = x + 1;" or "x++;" or "++x;" or "x = x = x + 1;".  The
difference is an expression which is considered an lvalue and one that is
not.

Gary

-----Original Message-----
From: Jean-Christophe Touvet [mailto:jct@EdelWeb.fr]
Sent: Tuesday, January 29, 2002 5:48 AM
To: Manuele Kirsch Pinheiro
Cc: Rob Corell; David Binderman; www-lib@w3.org
Subject: Re: w3c-libwww-5.2.8-7 bug report 



> I don't know if this statement is realy undefined in ANSI C, but it
> works as expected when using an ANSI C compiler (I did a little test to
> confirm it and it works ok in GNU C and Sun Workshop C compilers) .
> Indeed, using GNU C compiler over Red Hat 7.1, I didn't have any of the
> warning messages that David has using Compaq C compiler over the same
> plataform...
> So, I think we may safely ignore those warnings... :)

 Not a very scientific approach: "it works with 2 compilers, thus it
must be correct" ;-)

 However, mea culpa: I remembered the K&R example "a[i] = i++;" and
concluded that "i = ++i;" whould be undefined. Maybe it is under a
strict language interpretation (which would explain Compaq compiler
warning), but I admit that, while inelegant, I don't see how it could
give another result than expected.

 Sorry,

    -JCT-

Received on Tuesday, 29 January 2002 08:30:16 UTC