home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!psgrain!hippo!ucthpx!casper.cs.uct.ac.za!Gf16.CS.UCT.AC.ZA!mwodrich
- From: mwodrich@cs1.uct.ac.za (M WODRICH)
- Subject: Re: procedural types -- a bug in TP?
- Message-ID: <mwodrich.11.715425602@cs1.uct.ac.za>
- Lines: 48
- Sender: news@casper.cs.uct.ac.za (news)
- Organization: Computer Science Department, University of Cape Town
- References: <1992Aug28.154106.15275@news.columbia.edu>
- Date: Wed, 2 Sep 1992 09:20:02 GMT
-
- In article <1992Aug28.154106.15275@news.columbia.edu> stone@cunixb.cc.columbia.edu (Glenn Stone) writes:
- >From: stone@cunixb.cc.columbia.edu (Glenn Stone)
- >Subject: procedural types -- a bug in TP?
- >Date: 28 Aug 92 15:41:06 GMT
- >This seems to dumb, I'm sure I'm missing something right under my nose.
- >But anyway:
- >
- >I want to use a procedural type but my compiler (TP 5.5) objects. So
- >I copied the example right out of the manual (Ref Guide 5.0, p. 85 --
- >I've paraphrased it a bit):
- >------------------------------------------------
- >type
- > proc = procedure (var x,y : integer);
- >
- >var
- > p : proc;
- >
- >{F+}
- >procedure swap (a,b : integer);
- > begin
- > end;
- >{F-}
- >
- >begin
- >p := swap;
- >end.
- >------------------------------------------
- >
- >The compiler stops on the "p := swap" line and says
- >
- >Error 143: Invalid procedure or function reference
- >
- >Is this a bug, am I making some colossally stupid mistake, or am I in
- >the Twilight Zone?
- >
- Try saying P := @Swap;
-
- My Pascal is a bit rusty since I graduated to C++, but I think that should
- work. Regarding your possible visit to the Twilight Zone, send me a
- postcard !
- ----------------------------------------------------------------------
- ┐ ┌ ┌ He who says, does not know.
- │ ├┬─┬─┬─┤ He who knows, does not say.
- └─┴─┘└─┘ └─┘ - Lao Tzu.
-
- Om Nama Shivaya He who is not sure, mumbles.
- - Me.
- ----------------------------------------------------------------------
-