W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2002

Re: w3c-libwww-5.2.8-7 bug report

From: Joe Konczal <joe.konczal@nist.gov>
Date: Wed, 30 Jan 2002 12:08:15 -0500
Message-ID: <3C58287F.3050102@nist.gov>
To: Jean-Christophe Touvet <jct@EdelWeb.fr>
CC: "Desrochers, Gary" <Gary.Desrochers@fmr.com>, Manuele Kirsch Pinheiro <Manuele.Kirsch_Pinheiro@inrialpes.fr>, Rob Corell <rcorell@adobe.com>, David Binderman <d.binderman@virgin.net>, www-lib@w3.org
Jean-Christophe Touvet wrote:

>>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 =
> And what about "i = i++;" ?
> Would you increment "i" before or after the assignment ?
>    -JCT-
After, of course.  But the result would be the same as incrementing it 
before.  There is only one "i" and it gets incremented either way.  Try 
this little program, and let me know if you find any implementation of C 
where the value of "i" is not one in both cases.

#include <stdio.h>
#include <stdlib.h>

main(int argc, char *argv[])
  int i;

  i = 0;
  i = i++;
  printf("i = 0, i = i++, i => %d\n", i);

  i = 0;
  i = ++i;
  printf("i = 0, i = ++i, i => %d\n", i);

Received on Wednesday, 30 January 2002 12:08:24 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:54 UTC