Path: utzoo!utgpu!water!watmath!clyde!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: ANSI C idea: structure literals Summary: Correct syntax for anonymous remote functions Keywords: ANSI, structure literals Message-ID: <2927@haddock.ISC.COM> Date: 8 Mar 88 16:36:14 GMT References: <56@vsi.UUCP> <1988Feb28.130526.4147@jarvis.csri.toronto.edu> <2804@haddock.ISC.COM> <139@puivax.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 16 In article <139@puivax.UUCP> ian@puivax.UUCP (Ian Wilson) writes: >Another place where anonymous objects would be handy is for functions >embedded in data structures. For example: ... > (*(&remote( (*)(char * x), {printf("%s\n", x);} ))); Actually, to be consistent with my proposal the first operand of `remote` should be the type of the object, not of the pointer. Thus remote( void (char *x), {printf("%s\n", x);} ) would be equivalent to mentioning the (non-existent) name of the remote function, hence this gives you a function pointer without using "&". (As has been pointed out to me by e-mail, I made this mistake in my char[] example.) Using it as above would allow you to stuff it into a function table; or you could invoke it via remote( void (char *x), {printf("%s\n", x);} )("hello, world"); Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint