Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!bbn.com!mesard From: mesard@bbn.com (Wayne Mesard) Newsgroups: comp.lang.c Subject: Re: C optimizer Summary: Maybe pure funcitons should have to wear chastity belts. Keywords: C pure function optimization Message-ID: <36034@bbn.COM> Date: 15 Feb 89 15:04:55 GMT References: <515@larry.UUCP> <9648@smoke.BRL.MIL> Sender: news@bbn.COM Reply-To: mesard@BBN.COM (Wayne Mesard) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 20 In article <9648@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >There is no standard mechanism for an application to declare its own >functions as "pure"; however, if the compiler has access to all files >it may be able to make such a determination itself. Anyone want to challenge (by way of counter-example) the hypothesis that A function which is entirely composed of known "pure" operations* is, itself, pure. * Where pure operations is defined as functions that produce no side effects and return deterministic values, and most operators (excluding assignment to dereferenced pointers and globals). Hint: Sleep(3) would, I believe, be labelled "pure" under this definition, so something's still missing. -- unsigned *Wayne_Mesard(); MESARD@BBN.COM BBN, Cambridge, MA