🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3032

typedef void (*generic)()

#3032
From: Frans van Hoesel
Date: Wed, 16 Dec 1992 17:27
31 lines
1356 bytes
Hi,  

I have a problem in doing what I want to do in c.

a smaal exaplme
#include <stdio.h>
#include <stdlib.h>

typedef void (*generic)();

main() {
        generic f,g;
        int     i;
        f = (generic) printf;
        g = (generic) abs;

	i=-4;

	/* and now do something like :printf("some text %d\n",abs(i)
	  ), but using f and g instead !*/
}
This isn't the right group to ask (I know), but propably the best
There is also a remark from my compiler on some constructs stating that void pointer cannot be cast to function pointers. Is this allowed?

-- frans


-- 
      ================================================================
      ===  frans van hoesel               hoesel@igc.ethz.ch       ===
      ================================================================
Technical Details
Message-ID: <1992Dec16.172748.24120@bernina.ethz.ch>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!gumby!destroyer!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!chsun!bernina!hoesel

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!gumby!destroyer!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!chsun!bernina!hoesel
From: hoesel@igc.ethz.ch (Frans van Hoesel)
Subject: typedef void (*generic)()
Message-ID: <1992Dec16.172748.24120@bernina.ethz.ch>
Sender: news@bernina.ethz.ch (USENET News System)
Organization: University of Groningen, the Netherlands
Date: Wed, 16 Dec 1992 17:27:48 GMT
Lines: 31