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

RE: w3c-libwww-5.2.8-7 bug report

From: Desrochers, Gary <Gary.Desrochers@fmr.com>
Date: Wed, 30 Jan 2002 15:08:36 -0500
Message-ID: <1E053503E50CD5118EB500A0C9DB229EE1B743@MSGMMK578NTS.fmr.com>
To: "'Jean-Christophe Touvet'" <jct@EdelWeb.fr>, Joe Konczal <joe.konczal@nist.gov>
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
Off topic but fun.:-)

-----Original Message-----
From: Jean-Christophe Touvet [mailto:jct@EdelWeb.fr]
Sent: Wednesday, January 30, 2002 2:11 PM
To: Joe Konczal
Cc: Desrochers, Gary; Manuele Kirsch Pinheiro; Rob Corell; David
Binderman; www-lib@w3.org
Subject: Re: w3c-libwww-5.2.8-7 bug report 



> > And what about "i = i++;" ?
> >
> > Would you increment "i" before or after the assignment ?
>
> 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.

test>uname -a
SunOS test 5.5.1 Generic_103640-31 sun4m sparc SUNW,SPARCstation-5
test>gcc -v
gcc version 2.7.2
test>cat x.c

#include <stdio.h>

int main()
{
        int x = 0;
 
        x = x++;
        printf("%d\n", x);
        return(0);
}

test>gcc -Wall x.c ; ./a.out
0
test>gcc -Wall -O x.c ; ./a.out
1
test>

 With gcc 2.95.2 on Solaris 8, with or without optimization, the result
is always 1. But if I replace "x = x++;" with "x = x++ + 1;", the result
is 1 without optimization and 2 with -O (and still no compiler warning
of course).

    -JCT-

PS: we're now totally off-topic, but we can follow this discussion
privately if you want.
Received on Wednesday, 30 January 2002 15:09:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:40 GMT