home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / misc / 3577 < prev    next >
Encoding:
Text File  |  1992-11-10  |  2.8 KB  |  56 lines

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!mcsun!Germany.EU.net!rrz.uni-koeln.de!unidui!math.fu-berlin.de!Sirius.dfn.de!news.belwue.de!ira.uka.de!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!sun-barr!ames!agate!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!hrubin
  3. From: hrubin@mentor.cc.purdue.edu (Herman Rubin)
  4. Subject: Re: Pointers
  5. Message-ID: <BxJ39L.LCv@mentor.cc.purdue.edu>
  6. Organization: Purdue University Statistics Department
  7. References: <92Nov10.125426est.47525@neat.cs.toronto.edu> <BxIoDv.72J@mentor.cc.purdue.edu> <mwm.2lit@contessa.palo-alto.ca.us>
  8. Date: Wed, 11 Nov 1992 01:39:17 GMT
  9. Lines: 45
  10.  
  11. In article <mwm.2lit@contessa.palo-alto.ca.us> mwm@contessa.palo-alto.ca.us (Mike Meyer) writes:
  12. >In <BxIoDv.72J@mentor.cc.purdue.edu>, hrubin@pop.stat.purdue.edu (Herman Rubin) wrote:
  13. >> In article <92Nov10.125426est.47525@neat.cs.toronto.edu> tlai@cs.toronto.edu (Tony Wen Hsun Lai) writes:
  14. >> >ALGOL 68 and SIMULA 67 have user-defined types, dynamic memory, and
  15. >> >free-form syntax, no?  And why do you need explicit pointers to functions
  16. >> >when you can have procedure types, like Modula-2?
  17.  
  18. >> You need explicit pointers to functions when the caller does not know
  19. >> the name of the function being called, but the caller has received a
  20. >> pointer to the function.
  21.  
  22. >No, you don't need *explicit* pointers to functions. It's perfectly
  23. >reasonable (and I would argue, preferable) to allow function names
  24. >in argument lists. In C-oid style, this would be:
  25.  
  26.         ..............................
  27.  
  28. I found this difficult to read, and it does not seem that it handles
  29. the situation I envision.  The way that I would want to use pointers
  30. would be to have fl as the pointer to a fill function, and des as the
  31. pointer to a descriptor array, of which the first two arguments would
  32. be pointers to the current element of the buffer and the bounding position,
  33. and then when it is needed make sure that the current element is correct,
  34. and issue the call
  35.  
  36.     *fl(*des);
  37.  
  38. The calling subprogram need not know anything about *fl except that it
  39. fills the buffer, and does not need to know anything about *des except
  40. that the first element of *des is the pointer to the current element of
  41. the buffer, and the second element is the pointer to the bound.
  42.  
  43. It is quite possible that the calling subprogram might even use several
  44. of these, and again I point out that this subprogram need not know 
  45. anything more that the names of the pointers.
  46.  
  47. I will consider any suggestions to do this in a better manner, but I
  48. am not willing to make it any less flexible, nor to put any more burdens
  49. on the writers of the subprogram, nor of the (usually separately compiled)
  50. fill functions.
  51. -- 
  52. Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
  53. Phone: (317)494-6054
  54. hrubin@snap.stat.purdue.edu (Internet, bitnet)  
  55. {purdue,pur-ee}!snap.stat!hrubin(UUCP)
  56.