home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / misc / 3526 < prev    next >
Encoding:
Internet Message Format  |  1992-11-07  |  1.9 KB

  1. Path: sparky!uunet!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.lang.misc
  4. Subject: Re: Pointers
  5. Date: 6 Nov 1992 16:20:19 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 33
  8. Message-ID: <1de603INN5qv@early-bird.think.com>
  9. References: <1992Nov5.014143.15635@newshost.lanl.gov> <1992Nov5.051745.7369@linus.mitre.org> <1992Nov5.184831.16328@newshost.lanl.gov>
  10. NNTP-Posting-Host: telecaster.think.com
  11.  
  12. In article <1992Nov5.184831.16328@newshost.lanl.gov> jlg@cochiti.lanl.gov (J. Giles) writes:
  13. >C has actually committed two sins against array users - both as a
  14. >result of this coercion to pointer.  First, it is not notationally
  15. >convenient in C to program procedures which handle variable sized
  16. >conformable arrays.  Second, the coercion to pointer makes it 
  17. >impossible for the C compiler to *locally* determine whether 
  18. >incoming pointers are aliased.  If the user were offered a choice,
  19. >then he could declare the incoming arguments as pointers if he
  20. >wanted to *allow* aliasing, and he could declare them as arrays
  21. >(with or without variable dimensions) when he wanted to disallow
  22. >aliasing.
  23.  
  24. I don't think either of these sins is related to its array->pointer
  25. coercion feature.
  26.  
  27. The problem with variable-sized multidimensional arrays is due to the fact
  28. that C includes interior array dimensions as part of the static type of an
  29. array.  Note that GCC provides variable-sized arrays as an extension, using
  30. the intuitive notation.
  31.  
  32. And it's possible to have aliasing without pointer variables.  Fortran has
  33. this problem because parameters are passed by reference -- their solution
  34. was simply to legislate that programs are not permitted to pass array
  35. parameters (or is it all parameters) in such a fashion that such aliases
  36. would occur.  It's not possible to detect this statically in the general
  37. case.
  38.  
  39.  
  40. -- 
  41. Barry Margolin
  42. System Manager, Thinking Machines Corp.
  43.  
  44. barmar@think.com          {uunet,harvard}!think!barmar
  45.