Ptr to func doesn't like casting??

Brandon Allbery bsa at ncoast.UUCP
Tue Dec 4 00:13:45 AEST 1984


> Article <13900010 at acf4.UUCP>, from greenber at acf4.UUCP
+----------------
| 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!".
| 
| Well,
| 	(char *)varname = function();
| doesn't work (lvalue required).
| And,
| 	varname = (*function())();
| doesn't work consistantly.
| 

Perhaps lint and our C are more closely related than I thought they might
be; I once tried to use a

	typedef int (*func)();

and cc barfed all over it.  I forget what error it gave, except that
it looked like it was ignoring the pointer nature of the thing.  Anyone
know whence came this piece of brain-damage?

--bsa
-- 
  Brandon Allbery @ North Coast Xenix  |   the.world!ucbvax!decvax!cwruecmp!
6504 Chestnut Road, Independence, Ohio |       {atvax!}ncoast!{tdi1!}bsa
   (216) 524-1416             \ 44131  | E1439 at CSUOHIO.BITNET (friend's acct.)
				       |    BALLBERY (161-7070) on MCI Mail
---------------------------------------+---------------------------------------
	      Keeping the Galaxies safe for Civilization... :-)



More information about the Comp.lang.c mailing list