Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!necntc!linus!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: comp.lang.c Subject: Re: Another 'D' proposal (sigh) Message-ID: <2744@mmintl.UUCP> Date: 1 Mar 88 20:58:40 GMT References: <1893@phoenix.Princeton.EDU> <2230@bsu-cs.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT. Lines: 22 In article <2230@bsu-cs.UUCP> dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: >In article <1893@phoenix.Princeton.EDU> rjchen@phoenix.Princeton.EDU (Raymond Juimong Chen) writes: >>Propose that there be a way to declare "true functions", ie, functions >>whose return values depend on and are solely determined by the arguments >>passed to it. They also have no side-effects. >Declaring such functions is like using noalias--the compiler cannot >easily confirm that what the programmer claims is really true. True, but the compiler can easily check for a set of conditions which is sufficient for a function to be a "true" function, and issue a warning if these are not met. Basically, the function may not access global or static variables, call any non-true functions, nor dereference a pointer. (I may be missing some conditions here.) This will cover a significant fraction of the functions in this category. (Particularly if we ignore the C "arrays are pointers" confusion.) Actually, I was thinking about this just the other day. I'm still not convinced that it is sufficiently useful to be included. Does anyone have any data on how many function calls a good compiler can eliminate by such a feature? -- Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Ashton-Tate 52 Oakland Ave North E. Hartford, CT 06108