From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7728b533f7ab5fb6 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.sun.com!news.sun.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 07 Oct 2008 06:08:42 -0500 Newsgroups: comp.lang.ada Subject: Re: Avoiding side effects References: From: Ole-Hjalmar Kristensen Organization: Sun Microsystems Date: 07 Oct 2008 13:08:40 +0200 Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cache-Post-Path: news1nwk!unknown@khepri42.norway.sun.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-t0qWcDBgIJZLhDbschOtQfj1/TUjEA3DiMi/XansGp7ICCWvX5Dxa0cHDKomCBk2gnQPcS4B4kWYY7m!ZyvbMg8HmdcKq92VR6Yuxzxg3T1tBRAN8D5b3zaHyufvrbaz/Aq8bEcN X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Xref: g2news1.google.com comp.lang.ada:2261 Date: 2008-10-07T13:08:40+02:00 List-Id: Yes, I think any program which use a read/write interface to a file will have side effects in that sense. The only way I can think of for avoiding this would be to mmap the whole file, then it will appear as an array of bytes. >>>>> "AW" == Anders Wirzenius writes: AW> Thanks for that, too. The program I wrote did the job and was AW> sufficiently fast. My question was more about how to do it using AW> subprograms (functions) without side effects. AW> I suppose "Process records from..." and "Process tail..." are AW> having side effects if coded as subprograms, as they advance the AW> pointer in the two files. AW> -- AW> Anders -- C++: The power, elegance and simplicity of a hand grenade.