home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / gcc / bug / 2237 < prev    next >
Encoding:
Text File  |  1992-09-02  |  785 b   |  32 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tis.llnl.gov!carlson
  3. From: carlson@tis.llnl.gov (John Carlson)
  4. Subject: Increment and assignment (sleepy programmers see section 3.1 of C FAQ)
  5. Message-ID: <135161@lll-winken.LLNL.GOV>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: Lawrence Livermore National Laboratory
  8. Distribution: gnu
  9. Date: Wed, 2 Sep 1992 10:38:37 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 19
  12.  
  13. int i = 0;
  14. i = i++;
  15. printf("%d\n", i);
  16.  
  17. Values of i:
  18.  
  19. Sun 4.1.1 cc compiler produces: 1
  20. Sun C++ 2.1 produces: 1
  21. Optimized gcc produces: 1
  22. Unoptimized gcc 2.2.2 produces: 0
  23. AT&T cc compiler produces: 0
  24.  
  25. Don't use i = i++.
  26.  
  27. It would be nice if the compiler warned me about it.
  28.  
  29. John Carlson
  30. carlson@yottzumm.tis.llnl.gov
  31.  
  32.