|Compiler evaluation of parameters email@example.com (Bala Narasimhan) (1999-05-27)|
|Re: Compiler evaluation of parameters firstname.lastname@example.org (1999-05-29)|
|From:||email@example.com (Mike Albaugh)|
|Date:||29 May 1999 01:08:50 -0400|
|Organization:||Atari Games Corporation|
Bala Narasimhan (firstname.lastname@example.org) wrote:
: I would like to know why some C compilers evaluate and push function
: parameters from right to left will some others do it from left to right?
: Thank you,
: [Right to left makes it easier to match up varargs arguments at runtime.
: Left to right is marginally easier to generate code for at compile time.
: It's one of those underwear-like things, you like what you like. -John]
And of course, some compilers for various languages (including
C) evaluate the parameters in arbitrary (sometimes interleaved, as the
comma separating parameters is _not_ a "sequence point") order, and
don't "push" them at all...
One of my "favorite" memories is of attending a talk by a Very
Famous Asic Company on their new procedural design tools (pre-
VHDL/Verilog). As the tool-guru walked through some examples, I could
tell that his tools, based on <language redacted>, depended critically
on the order of evaluation of parameters. One of the <language>
developers was also at the talk, and since I was not familiar with the
language, I asked at the break: "Do you guaranteee the order of
evaluation of parameters?", to which he replied "Of course not. Why?".
I then dragged him over to the tool-smith, and asked that worthy: "Do
you depend on the order of evaluation of parameters?", to which _he_
replied "Of course. Why not?". I left them together, with the
admonition that "You two need to talk" :-)
Return to the
Search the comp.compilers archives again.