Separate data and function address spaces

Bill Poser poser at csli.Stanford.EDU
Fri Nov 10 11:01:47 AEST 1989


	Is there a reason why someone would write code like:

	char *p;
	int fn();
	p = (char *)fn;


whose non-portability has been under discussion? In this case you can
just declare p to be a function pointer to start with. The only
thing I can think of is that if you malloc some space for function pointers
you need to cast (char *) (the result of malloc) to the apropriate function
pointer, and cast this back to (char *) if you want to free() it.



More information about the Comp.lang.c mailing list