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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-27 04:45:45 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!eusc.inter.net!cs.tu-berlin.de!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: In-Out Parameters for functions Date: Tue, 27 Jan 2004 12:45:40 +0000 (UTC) Organization: GMUGHDU Message-ID: References: <1075159458.149886@master.nyc.kbcfp.com> <1lbc101ipcb8vu88jamto0b29c72jbu1rq@4ax.com> NNTP-Posting-Host: l1-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1075207540 18290 134.91.1.34 (27 Jan 2004 12:45:40 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Tue, 27 Jan 2004 12:45:40 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/800)) Xref: archiver1.google.com comp.lang.ada:4901 Date: 2004-01-27T12:45:40+00:00 List-Id: Dmitry A. Kazakov wrote: : On Tue, 27 Jan 2004 02:26:17 GMT, Hyman Rosen : wrote: : :>Robert A Duff wrote: :>> It does seem of some value to attempt to make sure "order doesn't matter". :> :>But since this will never be the case in Ada, the next best thing is to :>define the order. : : There could be also an opposite point of view. Fixing the evaluation : order you strengthen the "precondition" of the code. And how does it help, anyway? If functions have side effects, you have to consider all values affected and affecting the function, recursively. Is that practial (or, the next best thing)? Example: #include class Weird { int const modulus; public: Weird(int step) : modulus(step) {} int state() const; }; int Weird::state() const { extern int global_state; return ++global_state % modulus; } int global_state = 2; bool operator==(const Weird& a, const Weird& b) { return a.state() == b.state(); } int main(void) { Weird x(3), y(4); const Weird& w1 = x, w2 = y; while (w1 == w2) { std::cout << "we have reached the predecessors of " << w1.state() << " and " << w2.state() << std::endl; } return 0; }