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

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!sakkinen
  3. From: sakkinen@jyu.fi (Markku Sakkinen)
  4. Subject: Re: Pointers
  5. Message-ID: <1992Nov13.072834.4673@jyu.fi>
  6. Organization: University of Jyvaskyla, Finland
  7. References: <BxJzzv.4H7@mentor.cc.purdue.edu> <721539019@sheol.UUCP> <1dujcuINNru4@early-bird.think.com>
  8. Date: Fri, 13 Nov 1992 07:28:34 GMT
  9. Lines: 39
  10.  
  11. In article <1dujcuINNru4@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
  12. > ...
  13. >C's function pointers are almost exactly like the procedure variables that
  14. >many other languages have.  As in many other aspects, C has overloaded an
  15.  
  16. Indeed, I have always found it helpful to think of procedure variables
  17. in languages like Modula-2 as actually being only pointers to procedures,
  18. since no other operations are applicable to them than those
  19. of pointer variables.
  20.  
  21. > ...
  22. >case the indirection isn't required.  You can't cast between them and
  23. >non-function pointers.
  24.  
  25. In K&R C you could (char*), and in C++ you can (void*).
  26.  
  27.  ...
  28. >they specified the declaration syntax accordingly.  But when you look at
  29. >C++ and its member function pointers, you see that these are more like the
  30. >traditional procedure variables (the environment in this case is the "self"
  31. >object); however, they've kept C's function "pointer" syntax for declaring
  32. >them.
  33.  
  34. Actually, they are farther away from traditional procedure variables
  35. than are ordinary function pointers.  A "member function pointer" is more
  36. like an offset:  it does not by itself designate an object, and not even a
  37. specific function in the case of virtual functions (dynamic binding
  38. occurs, depending on the actual class of the object with which
  39. the "member function pointer" is applied).
  40.  
  41. ----------------------------------------------------------------------
  42. Markku Sakkinen (sakkinen@jytko.jyu.fi)
  43.        SAKKINEN@FINJYU.bitnet (alternative network address)
  44. Department of Computer Science and Information Systems
  45. University of Jyvaskyla (a's with umlauts)
  46. PL 35
  47. SF-40351 Jyvaskyla (umlauts again)
  48. Finland
  49. ----------------------------------------------------------------------
  50.