How do I cast to "pointer to function returning int" ?

timcc at csv.viccol.edu.au timcc at csv.viccol.edu.au
Wed Apr 11 06:07:46 AEST 1990


Given the following C source:

extern void bar () ;
extern void blurfl () ;
extern void frobjitz () ;

struct foo {
   char *name ;
   int (*function) () ;
   } ;

struct foo foo_table[] = {
   "bar",	(int * ()) bar,
   "blurfl",	(int * ()) blurfl,
   "frobjitz",	(int * ()) frobjitz,
   } ;

I get the following errors from GNU C, version 1.36:

above_source:11: conversion to non-scalar type requested
above_source:12: conversion to non-scalar type requested
above_source:13: conversion to non-scalar type requested

So how do I cast to "pointer to function returning int" ?
--
Tim Cook     Systems Administrator, Victoria College Computer Services

parrot - n.  An animal that has the ability to imitate man, but not the
             intelligence to refrain from doing so.



More information about the Comp.lang.c mailing list