home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / pascal / 5165 < prev    next >
Encoding:
Text File  |  1992-09-01  |  2.0 KB  |  60 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!psgrain!hippo!ucthpx!casper.cs.uct.ac.za!Gf16.CS.UCT.AC.ZA!mwodrich
  3. From: mwodrich@cs1.uct.ac.za (M WODRICH)
  4. Subject: Re: procedural types -- a bug in TP?
  5. Message-ID: <mwodrich.11.715425602@cs1.uct.ac.za>
  6. Lines: 48
  7. Sender: news@casper.cs.uct.ac.za (news)
  8. Organization: Computer Science Department, University of Cape Town
  9. References: <1992Aug28.154106.15275@news.columbia.edu>
  10. Date: Wed, 2 Sep 1992 09:20:02 GMT
  11.  
  12. In article <1992Aug28.154106.15275@news.columbia.edu> stone@cunixb.cc.columbia.edu (Glenn Stone) writes:
  13. >From: stone@cunixb.cc.columbia.edu (Glenn Stone)
  14. >Subject: procedural types -- a bug in TP?
  15. >Date: 28 Aug 92 15:41:06 GMT
  16. >This seems to dumb, I'm sure I'm missing something right under my nose.  
  17. >But anyway:
  18. >
  19. >I want to use a procedural type but my compiler (TP 5.5) objects.  So
  20. >I copied the example right out of the manual (Ref Guide 5.0, p. 85 --
  21. >I've paraphrased it a bit):
  22. >------------------------------------------------
  23. >type
  24. >   proc = procedure (var x,y : integer);
  25. >
  26. >var
  27. >   p : proc;
  28. >
  29. >{F+}
  30. >procedure swap (a,b : integer);
  31. >   begin
  32. >   end;
  33. >{F-}
  34. >
  35. >begin
  36. >p := swap;
  37. >end.
  38. >------------------------------------------
  39. >
  40. >The compiler stops on the "p := swap" line and says
  41. >
  42. >Error 143: Invalid procedure or function reference
  43. >
  44. >Is this a bug, am I making some colossally stupid mistake, or am I in
  45. >the Twilight Zone?
  46. >
  47. Try saying P := @Swap;
  48.  
  49. My Pascal is a bit rusty since I graduated to C++, but I think that should 
  50. work. Regarding your possible visit to the Twilight Zone, send me a 
  51. postcard !
  52. ----------------------------------------------------------------------
  53.   ┐   ┌      ┌          He who says, does not know.
  54.   │   ├┬─┬─┬─┤          He who knows, does not say.
  55.   └─┴─┘└─┘ └─┘                                  - Lao Tzu.
  56.  
  57.   Om Nama Shivaya       He who is not sure, mumbles.
  58.                                                 - Me.
  59. ----------------------------------------------------------------------
  60.