Wireshark-dev: Re: [Wireshark-dev] Revisiting precedence of logical AND vs OR

From: Roland Knall <rknall@xxxxxxxxx>
Date: Mon, 4 Apr 2022 11:39:55 +0200
I think the system may be improved by advising the user via a rtoolwindow in the entry dialog, on how to properly stack the operators. I am currently looking into that. But at the very least, the release notes should be updated to contain a note on this.

cheers

Am Mo., 4. Apr. 2022 um 09:59 Uhr schrieb Guy Harris <gharris@xxxxxxxxx>:
On Apr 3, 2022, at 5:25 PM, João Valverde <j@xxxxxx> wrote:

> I removed the "parenthesis around && within ||" warning/suggestion in [1], then noticed the precedence of AND and OR is flipped from most programming languages, then found [2].
>
> The consensus seemed to be in favor of being consistent with the rest of the world, but in the end it wasn't done.
>
> Should AND have higher precedence than OR?

Yes, especially if, as I seem to remember Gerald indicating would be the case, the next release will be 4.0 rather than 3.8.  That's the order in C, and presumably in languages that follow "C" with one or more characters from the top row of the keyboard :-), as well as those preceding "C" with the word "Objective" :-), as well as Java, Perl, Python, Lua and BPF filters.

We should probably mention this very notably in the documentation, including the release notes, and recommend that people use parentheses in all packet-matching expressions that use both AND and OR.

We may want to have some sort of warning (with the different UI design) as well.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe