🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1043

Increment and assignment (sleepy programmers see section 3.1 of C FAQ)

#1043
From: John Carlson
Date: Wed, 02 Sep 1992 10:38
18 lines
814 bytes
int i = 0;
i = i++;
printf("%d\n", i);

Values of i:

Sun 4.1.1 cc compiler produces: 1
Sun C++ 2.1 produces: 1
Optimized gcc produces: 1
Unoptimized gcc 2.2.2 produces: 0
AT&T cc compiler produces: 0

Don't use i = i++.

It would be nice if the compiler warned me about it.

John Carlson
carlson@yottzumm.tis.llnl.gov
Technical Details
Message-ID: <135161@lll-winken.LLNL.GOV>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tis.llnl.gov!carlson

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tis.llnl.gov!carlson
From: carlson@tis.llnl.gov (John Carlson)
Subject: Increment and assignment (sleepy programmers see section 3.1 of C FAQ)
Message-ID: <135161@lll-winken.LLNL.GOV>
Sender: gnulists@ai.mit.edu
Organization: Lawrence Livermore National Laboratory
Distribution: gnu
Date: Wed, 2 Sep 1992 10:38:37 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 19