- Subject: Re: Template function
- From: Paul Boekholt <p.boekholt@xxxxxxxxx>
- Date: Wed, 4 Dec 2002 00:02:08 +0100
On Tue, Dec 03, 2002 at 11:03:41AM -0800, Malcolm Dew-Jones wrote:
>
> > If you have:
> >
> > a;---------+
> > b;------+ |
> > c;--\ v v
> > x = ()+()+();
> >
>
> so it ends up being
>
> > x = (c)+(b)+(a);
No, my point was that this
"a";
"b";
() + ();
message;
will output "ab", so that's a+b and not b+a.
similarly
1;
2;
()-();
sprintf( "%d", () );
message;
will output -1.
So the answer to my question seems to be that these expressions are
evaluated in order of precedence, and otherwise from right to left, popping
values as you go.
This will probably also apply to expressions with function calls. How is
this done in C?
However this
1;2;5; ()+()-(); sprintf ("%d"); message;
will output -6.
So first it adds 2 to 5 then it subtracts that from 1, getting the order of
operands in the subtraction all wrong?
If I use RPN notation it seems to be more consistent
1;2;5;
. - -
gives me 1 - (2-5) = 4, which is consistent with what a rpn calculator will
tell you.
Anyway rpn notation is not documented and slang mode doesn't understand it
either.
> > then the following code will get generated:
> >
> > PUSH a
> > PUSH b
> > PUSH c
is this assembly language?
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2002 date index]
[2002 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]