Re: Fundamental question
From: Keith Thompson (kst-u_at_mib.org)
Date: 06/07/04
- Next message: Prashanth Ellina: "Re: OOP in C!"
- Previous message: Eric Sosman: "Re: data storage question..."
- In reply to: Guillaume: "Re: Fundamental question"
- Next in thread: Mabden: "Re: Fundamental question"
- Reply: Mabden: "Re: Fundamental question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 07 Jun 2004 21:18:43 GMT
Guillaume <grsNOSPAM@NO-SPAMmail.com> writes:
> > Thus your claim of "equal priority" is refuted.
>
> Is it? I'm not sure you understood what I meant by that.
>
> If && and || don't have equal priority, which of them
> has higher priority then? Good luck. ;-)
>
> Both logical operators guarantee left-to-right evaluation,
> and that is it. This does not add up to different priority
> in the algebraic sense, as in: 'A + B * C'. This is what
> I meant. '*' has higher priority than '+'.
>
> Is what I said clearer now?
No, it isn't.
I thought you were making some distinction between priority and
precedence, but I don't think you are.
A + B * C is equivalent to A + (B * C), so "*" has higher precedence
than "+".
A || B && C is equivalent to A || (B && C), so "&&" has higher
precedence than "||".
The "&&" and "||" operators are evaluated left-to-right, with
short-circuit semantics, but that's a separate issue. For "+" and
"*", precedence is a question of which operators apply to which
operands; it's more syntactic than semantic. The precedence of the
"&&" and "||" operators is determined in exactly the same way.
-- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> We must do something. This is something. Therefore, we must do this.
- Next message: Prashanth Ellina: "Re: OOP in C!"
- Previous message: Eric Sosman: "Re: data storage question..."
- In reply to: Guillaume: "Re: Fundamental question"
- Next in thread: Mabden: "Re: Fundamental question"
- Reply: Mabden: "Re: Fundamental question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|