🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2011

casting pointers to functions

#2011
From: Michael J Zehr
Date: Tue, 20 Nov 1990 20:32
20 lines
1364 bytes
Continuing the discussion of pointers to functions: you can cast them to
any other pointer to function, and cast them back, and use them.  i'm
having a problem doing this, however (using the VAXC compiler for VMS,
some fairly recent version).

I tried the example in K&R2 (early edition, with the black stripe on the
cover) for qsort where they first mention pointers to functions, and
some other variations on it.  My compiler always says: target or source
of conversion is non-computable.

I think the compiler is broken, but before i complain to DEC, could
someone post an example of the right way to cast a function to one kind
of pointer, then back, and call it?

thanks,
michael j zehr

(i just know i'm going to regret asking this right before i leave my
computer for a few days.  please see if someone has posted an example
before mailing me one so i don't get 100 messages.)
Technical Details
Message-ID: <1990Nov20.203201.21046@athena.mit.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!e40-008-7.MIT.EDU!tada

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!e40-008-7.MIT.EDU!tada
From: tada@e40-008-7.MIT.EDU (Michael J Zehr)
Newsgroups: comp.std.c
Subject: casting pointers to functions
Summary: problems with VAXC
Message-ID: <1990Nov20.203201.21046@athena.mit.edu>
Date: 20 Nov 90 20:32:01 GMT
Sender: daemon@athena.mit.edu (Mr Background)
Organization: Massachusetts Institute of Technology
Lines: 20