home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18790 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  1.5 KB

  1. Path: sparky!uunet!world!ksr!jfw
  2. From: jfw@ksr.com (John F. Woods)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Question to test general C knowledge
  5. Message-ID: <20354@ksr.com>
  6. Date: 22 Dec 92 14:36:52 EST
  7. References: <19980@ksr.com> <PTmLVB4w165w@quest.UUCP> <1992Dec11.175620.20308@crd.ge.com> <1992Dec12.224541.29854@thunder.mcrcim.mcgill.edu> <1992Dec13.045828.1714@crd.ge.com> <1992Dec14.150401.1283@cae.prds.cdx.mot.com> <1992Dec15.144244.3559@crd.ge.com>
  8. Sender: news@ksr.com
  9. Lines: 28
  10.  
  11. volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe) writes:
  12. >No, you're missing the point. Real compilers don't go out of their way 
  13. >to take advantage of undefined behavior and cause trouble.
  14.  
  15. Real compilers often cause trouble without going out of their way.
  16. Real good programmers don't go out of their way to take advantage of
  17. undefined behavior just because all six copies of Microsoft C give the
  18. same results.
  19.  
  20.  
  21. >However, I also raised an issue concerning
  22. >whether or not the expression *really* violates the shall-rule in
  23. >3.3, and that depends on the definition of the term "modify" as used
  24. >in section 3.3. As far as I can tell, no one has commented on that issue
  25. >yet.
  26.  
  27. I asked Doug Gwyn.  He concurred that "x = ++x;" falls under the restriction;
  28. "modify" does not mean "changed" in that context, just as it does not in
  29. several other contexts in the standard:
  30.  
  31.     const int i = 4;
  32.     int *ip = (int *)&i;
  33.  
  34.     *ip = 4;
  35.  
  36. I hope you agree that this is undefined.  Doug is not the ANSI Committee, of
  37. course, so if you want a definitive ruling, you can submit an RFI.
  38.  
  39.