home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.misc
- 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
- From: hrubin@mentor.cc.purdue.edu (Herman Rubin)
- Subject: Re: Pointers
- Message-ID: <BxJ39L.LCv@mentor.cc.purdue.edu>
- Organization: Purdue University Statistics Department
- References: <92Nov10.125426est.47525@neat.cs.toronto.edu> <BxIoDv.72J@mentor.cc.purdue.edu> <mwm.2lit@contessa.palo-alto.ca.us>
- Date: Wed, 11 Nov 1992 01:39:17 GMT
- Lines: 45
-
- In article <mwm.2lit@contessa.palo-alto.ca.us> mwm@contessa.palo-alto.ca.us (Mike Meyer) writes:
- >In <BxIoDv.72J@mentor.cc.purdue.edu>, hrubin@pop.stat.purdue.edu (Herman Rubin) wrote:
- >> In article <92Nov10.125426est.47525@neat.cs.toronto.edu> tlai@cs.toronto.edu (Tony Wen Hsun Lai) writes:
- >> >ALGOL 68 and SIMULA 67 have user-defined types, dynamic memory, and
- >> >free-form syntax, no? And why do you need explicit pointers to functions
- >> >when you can have procedure types, like Modula-2?
-
- >> You need explicit pointers to functions when the caller does not know
- >> the name of the function being called, but the caller has received a
- >> pointer to the function.
-
- >No, you don't need *explicit* pointers to functions. It's perfectly
- >reasonable (and I would argue, preferable) to allow function names
- >in argument lists. In C-oid style, this would be:
-
- ..............................
-
- I found this difficult to read, and it does not seem that it handles
- the situation I envision. The way that I would want to use pointers
- would be to have fl as the pointer to a fill function, and des as the
- pointer to a descriptor array, of which the first two arguments would
- be pointers to the current element of the buffer and the bounding position,
- and then when it is needed make sure that the current element is correct,
- and issue the call
-
- *fl(*des);
-
- The calling subprogram need not know anything about *fl except that it
- fills the buffer, and does not need to know anything about *des except
- that the first element of *des is the pointer to the current element of
- the buffer, and the second element is the pointer to the bound.
-
- It is quite possible that the calling subprogram might even use several
- of these, and again I point out that this subprogram need not know
- anything more that the names of the pointers.
-
- I will consider any suggestions to do this in a better manner, but I
- am not willing to make it any less flexible, nor to put any more burdens
- on the writers of the subprogram, nor of the (usually separately compiled)
- fill functions.
- --
- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
- Phone: (317)494-6054
- hrubin@snap.stat.purdue.edu (Internet, bitnet)
- {purdue,pur-ee}!snap.stat!hrubin(UUCP)
-