home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14492 < prev    next >
Encoding:
Internet Message Format  |  1992-08-25  |  2.4 KB

  1. Path: sparky!uunet!stanford.edu!unix!mxmora
  2. From: mxmora@unix.SRI.COM (Matt Mora)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: incrementation differences/THINK C 4.0 vs. 5.0
  5. Message-ID: <38119@unix.SRI.COM>
  6. Date: 25 Aug 92 16:26:29 GMT
  7. References: <1992Aug24.223423.24473@kronos.arc.nasa.gov> <1992Aug24.232700.7896@Csli.Stanford.EDU> <BtIJq6.3yw@taligent.com>
  8. Organization: SRI International, Menlo Park, California
  9. Lines: 55
  10.  
  11. In article <BtIJq6.3yw@taligent.com> keith@taligent.com (Keith Rollin) writes:
  12. >
  13. >I don't think that's a valid assumption. Although it might be disconcerting, I
  14. >don't think there's anything preventing a compiler from evaluating your sample
  15. >line one way during one compile, and the very same compiler evaluating it a
  16. >different way during a subsequent compile. ANSI spec section 3.3.16 says "The
  17. >order of evaluation of the operands is unspecified."
  18.  
  19. Don't you just love C! All the cool things that you can do are the very
  20. same things you have to worry about. Pretty soon you'll be writing code like
  21. this just to be safe. i = i + 1;  :-)
  22.  
  23. >On the other hand, if I ever _did_ run across a compiler like that, I'd worry
  24. >about the brain of the guy who wrote it.
  25.  
  26. It might act like that if you turn on optimization. It could happen. Yeah and 
  27. monkeys might fly out of my butt.
  28.  
  29. Why can't there be a smart compiler? Why can't it take a chunk of code
  30. chew on it all night and in the morning report "After 276 optimitation
  31. passes I found that moving this varible outside the loop and declaring it as a 
  32. register variable, performance will improve by 56%." And show you the optimized
  33. SOURCE code.
  34.  
  35. When a compiler doesn't know the best way to go why doesn't it just ask?
  36.  
  37. "not sure how you want the order of evaluation of this line:"
  38.      lab[i] = temp[i++];  //****THIS IS THE PROBLEM
  39.  
  40. "Maybe you mean:"
  41.      lab[i] = temp[i]; i++;  //****THIS IS THE PROBLEM
  42.  
  43. Also why can't the compiler say this when a ";" is missing.
  44.  
  45. Missing an ";" at the end of this line. Should I add one?"
  46. "Add one and Continue" or "Cancel"
  47.  
  48. instead of
  49.  
  50. "Missing a ";" at the end of statement."
  51.  
  52. and stop compiling. 
  53.  
  54. Compilers have a long way to go yet. I can't believe that the Mac user
  55. interface hasn't worked its magic on compiler designers yet.
  56.  
  57.  
  58.  
  59.  
  60. Matt
  61. -- 
  62. ___________________________________________________________
  63. Matthew Mora                |   my Mac  Matt_Mora@sri.com
  64. SRI International           |  my unix  mxmora@unix.sri.com
  65. ___________________________________________________________
  66.