Ptr to func doesn't like casting??

greenber at acf4.UUCP greenber at acf4.UUCP
Mon Nov 26 08:23:00 AEST 1984


Here is an interesting one (I think!!):

given a declaration such as:

int	(* varname)();

it certainly should point to a function returning int.
Now if I wish to temporarily hold a pointer to a string there, and I
get the pointer from a function:

char	*function();

	varname = function();

barfs in any of the lint-like guys I use with a legitimate gripe, that
is "pointers don't point to same object, you dumbo!".


	(char *)varname = function();
doesn't work (lvalue required).

	varname = (*function())();
doesn't work consistantly.

So what's a poor boy to do?  In particular, I am using this under Lattice C.
Let me know at the below address:

Ross M. Greenberg  @ NYU   ---->  allegra!cmcl2!acf4!greenber  <----

More information about the Comp.lang.c mailing list