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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f188b1cd9c1f24dc X-Google-Attributes: gid103376,public From: "William D. Ghrist" Subject: Re: Parameter evaluation order Date: 1998/04/06 Message-ID: <3528CEB6.EDE@pgh.net>#1/1 X-Deja-AN: 341469613 Content-Transfer-Encoding: 7bit References: <6g9d2o$tfg$1@nnrp1.dejanews.com> Mime-Version: 1.0 Reply-To: ghristwd@pgh.net Content-Type: text/plain; charset=us-ascii Organization: Westinghouse NPD; but these are My own Humble Opinions Newsgroups: comp.lang.ada Date: 1998-04-06T00:00:00+00:00 List-Id: Mark.Rutten@dsto.defence.gov.au wrote: > > I'm using GNAT3.09 on WindowsNT (and also Solaris, but I didn't get > this problem). > > I compiled a procedure call similar to the following > > proc(func_one,func_two); > > The program relies on func_one being called _before_ func_two. But > at run-time the code above did the opposite! Is this a bug (and if so, has it > been fixed in 3.10)? Or is there something written in the language definition > to justify this behaviour? > > Thanks, > Mark Rutten > > -----== Posted via Deja News, The Leader in Internet Discussion ==----- > http://www.dejanews.com/ Now offering spam-free web-based newsreading Yes, it is a bug in your program. The order of execution of parameters is not defined (this is true in other languages besides Ada, as well). This is one of the reasons that it is considered poor practice to write functions with side effects. If you must use functions with side effects that result in situations like your example, then the valid way to proceed is to invoke the functions first, storing their return values in variables, then to call the procedure with the variables as parameters. Regards, Bill Ghrist