Function pointers.. help!

Conor P. Cahill cpcahil at virtech.UUCP
Sat Oct 14 11:22:13 AEST 1989


In article <3005 at ndsuvax.UUCP>, nebakke at ndsuvax.UUCP (Jeff Bakke) writes:

> Now, to me, this seems alright, but to the  Turbo c 2.0 compiler, it
> says that a Storage class is required.

Assuming that the code you compiled looked as follows:

void (*border_proc)();  
void Assign_border(void (*user_border)()){
  border_proc = user_border;
}

You should have had no problems with a compiler that correctly handles 
the new ANSI formal parameter declarations.  pcc on 386/ix doesn't handle
it, but the fix was simple:

void Assign_border(user_border)
	void (*user_border)();
{
  border_proc = user_border;
}

gcc correctly handles either case.


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.lang.c mailing list