home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / misc / 3713 < prev    next >
Encoding:
Internet Message Format  |  1992-11-16  |  2.0 KB

  1. Path: sparky!uunet!spool.mu.edu!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!tmb
  2. From: tmb@arolla.idiap.ch (Thomas M. Breuel)
  3. Newsgroups: comp.lang.misc
  4. Subject: Re: Pointers
  5. Date: 16 Nov 92 13:55:34
  6. Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
  7.     Perceptive)
  8. Lines: 28
  9. Message-ID: <TMB.92Nov16135534@arolla.idiap.ch>
  10. References: <721539019@sheol.UUCP> <BxLyv1.CG4@mentor.cc.purdue.edu> <721626972@sheol.UUCP>
  11.     <BxpsHo.MID@mentor.cc.purdue.edu> <721864322@sheol.UUCP>
  12. Reply-To: tmb@idiap.ch
  13. NNTP-Posting-Host: arolla.idiap.ch
  14. In-reply-to: throopw@sheol.UUCP's message of 16 Nov 92 00:15:16 GMT
  15.  
  16. In article <721864322@sheol.UUCP> throopw@sheol.UUCP (Wayne Throop) writes:
  17.  
  18.    : From: hrubin@mentor.cc.purdue.edu (Herman Rubin)
  19.    : This is not a change in subject.  It is the question of whether one
  20.    : is allowed to directly use the machine hardware, or whether one must
  21.    : HOPE that the compiler writer considered what you are doing when the
  22.    : compiler was produced.  
  23.  
  24.    Nonsense.  Even if your notation is a pointer notation, you must HOPE
  25.    that the compiler writer will translate that into the machine
  26.    instructions you think are best for your task.
  27.  
  28. In fact, more importantly, if you use pointer notation when you mean
  29. array indexing, you are going to get less then optimal performance on
  30. different hardware. Array indexing can be transformed relatively
  31. easily by a compiler into pointer code, but the reverse transformation
  32. is much harder.
  33.  
  34. This lesson generalizes: if you provide a wide array of high-level
  35. abstractions, the compiler can choose the best implementation for the
  36. given hardware, and if you choose your abstractions well, there need
  37. not be any runtime cost associated with this. On the other hand, if
  38. you program directly in terms of low-level features, you may be able
  39. to optimize your code for one particular architecture (but only if you
  40. know exactly what you are doing), but you will get poor performance on
  41. other architectures.
  42.  
  43.                     Thomas.
  44.