Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!ncar!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.std.c Subject: Re: function returning pointer to itself Message-ID: <12446@mimsy.UUCP> Date: 13 Jul 88 13:04:06 GMT References: <5485@batcomputer.tn.cornell.edu> <9667@eddie.MIT.EDU> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 17 In article <9667@eddie.MIT.EDU> jbs@fenchurch.MIT.EDU (Jeff Siegal) writes: >... the following should suffice: > >typedef void *(*NextStateFun)(); No good: the dpANS does not say that data pointers are the same `size' as function pointers, and indeed, on (e.g.) the Univac 1100 series, as I understand it, data pointers are 2 words while function pointers are 18 words. Hence stuffing a function pointer into a data pointer will lose information. The dpANS *does* guarantee that pointers to functions are all the same `size' (I think), so: typedef void (*(*NextStateFun)())(); and go from there. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris