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,2cb1f0b6d642e1dc X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: Pascal Calling Convention Date: Thu, 24 Mar 2011 12:20:40 -0700 Organization: None to speak of Message-ID: References: <9b04626e-567d-408c-aab3-39b964b3ffd6@l2g2000prg.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx01.eternal-september.org; posting-host="mytEQcPL+ceHcrnNa7VoaQ"; logging-data="585"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/aNvQTjihQhkNgn1EFMQqx" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:1GFteNUo2LYBQTD20bLQ6p8Ep2I= sha1:Xmk+hk0X/njjVtN0ZMzLw9I4JNM= Xref: g2news1.google.com comp.lang.ada:18433 Date: 2011-03-24T12:20:40-07:00 List-Id: Dennis Lee Bieber writes: > On Thu, 24 Mar 2011 01:43:57 +0100, Yannick DuchĂȘne (Hibou57) > declaimed the following in comp.lang.ada: > >> [ebp+0] := ... [ebp+4] := ... and so on. But I feel to remember parameter >> passing order for WinAPI is the reversed one than C. I will have a test >> tomorrow to check (I am not running Windows right now). > > Could it be (hypothesis) that it is the parameter /evaluation/ order > which is reversed? > > That is, does > > i = 0; > someC(i++, i++, i++); > > produce > (0, 1, 2) > or > (2, 1, 0) On my system, it produced (2, 1, 0), but this doesn't mean anything. In C, the order of evaluation of function arguments is explicitly unspecified. Furthermore, in this particular case, the multiple modifications to the same object without an intervening sequence point mean that the behavior of the program is undefined; it could legitimately print "a suffusion of yellow" or cause your keyboard to explode. (C's "undefined behavior" is very much like Ada's "erroneous execution" -- and IMHO C chose a better term to describe it.) Furthermore, the order of evaluation of the argument expressions isn't *necessarily* related to the order in which the results are pushed onto the stack (assuming there even is a stack). -- Keith Thompson (The_Other_Keith) kst-u@mib.org Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"