Path: utzoo!dciem!nrcaer!cognos!jimp From: jimp@cognos.uucp (Jim Patterson) Newsgroups: comp.lang.c Subject: Re: Variable function names Message-ID: <2006@cognos.UUCP> Date: 28 Dec 87 05:21:50 GMT Article-I.D.: cognos.2006 Posted: Mon Dec 28 00:21:50 1987 References: <973@russell.STANFORD.EDU> <47000025@uxe.cso.uiuc.edu> Reply-To: jimp@cognos.UUCP (Jim Patterson) Organization: Cognos Inc., Ottawa, Canada Lines: 19 In article <47000025@uxe.cso.uiuc.edu> mcdonald@uxe.cso.uiuc.edu writes: >I learned C with the explicit assumption that, since it allowed both >data and function pointers, one could take an array, write a program that >generated compiled code in that array, cast the address of (the first >byte of) the array to a function pointer, and call that function. > I have since learned that on some systems (i.e. 80286 Xenix in anything >except single-segment model) it won't work, and that ANSI C does not >require it to work (A FATAL FLAW). This is hardly a FATAL FLAW, since it's an unusual application that would depend on such an ability. It's also a stance that is consistent with the ANSI C objective of standardizing a version of C that is widely implementable. Executing code in data space is extremely difficult on some architectures, for example the HP/3000 which has completely segregated code and data spaces. -- Jim Patterson Cognos Incorporated UUCP:decvax!utzoo!dciem!nrcaer!cognos!jimp P.O. BOX 9707 PHONE:(613)738-1440 3755 Riverside Drive Ottawa, Ont K1G 3Z4