home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / linux / 9908 < prev    next >
Encoding:
Text File  |  1992-09-07  |  1.2 KB  |  35 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!kithrup!cygnus.com!dje
  3. From: dje@cygnus.com (Doug Evans)
  4. Subject: Re: GCC 2.2.2d bug
  5. Organization: Cygnus Support
  6. Date: Sat, 05 Sep 1992 01:33:20 GMT
  7. Message-ID: <1992Sep05.013320.2317@kithrup.COM>
  8. X-Newsreader: Tin 1.1 PL5
  9. References: <1992Sep4.202913.14346@hippo.ru.ac.za>
  10. Sender: news@kithrup.COM (Network News)
  11. Nntp-Posting-Host: cygnus.com
  12. Lines: 21
  13.  
  14. Pieter Immelman (pi@oliver.sun.ac.za) wrote:
  15. : I have found that gcc is generating the wrong code for the following
  16. : code fragment:
  17. :   int p = 10;
  18. :   p = p++;
  19.  
  20. My, albeit limited, reading of the standard says that the behaviour
  21. is "unspecified" - the implementor can choose what happens.
  22.  
  23. ANSI introduced the concept of "sequence points" to aid in pinning down
  24. exactly when various things occur. In this particular case, the standard
  25. says the increment "shall occur between the previous and next sequence point."
  26. So gcc is perfectly free to increment {p} after the assignment.
  27.  
  28. And, of course, programs that depend upon unspecified behaviour are
  29. nonportable. Etc. etc. etc.
  30.  
  31. --
  32. Doug Evans        | With views like these ...
  33. dje@cygnus.com    |                           who needs disclaimers.
  34.