February 24, 2006 writef() | ||||
---|---|---|---|---|
| ||||
I created a stack using a LinkedList. This worked, but when testing it I found using, writef("%s, %s, %s", stack.pop(), stack.pop(), stack.pop()); would present the stack as a fifo. I assume the results are because it is evaluating the arguments from right to left. Why? |
February 24, 2006 Re: writef() | ||||
---|---|---|---|---|
| ||||
Posted in reply to nascent | nascent wrote:
> I created a stack using a LinkedList. This worked, but when testing it I found using,
>
> writef("%s, %s, %s", stack.pop(), stack.pop(), stack.pop());
>
> would present the stack as a fifo. I assume the results are because it is evaluating the arguments from right to left. Why?
The order of evaluation is undefined. In this case, the ABI of your architecture says function arguments are pushed on the stack from the right to left. Therefore, it is also convenient for the compiler to evaluate them in that order.
/Oskar
|
Copyright © 1999-2021 by the D Language Foundation