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

From: João Valverde <j@xxxxxx>
Date: Mon, 4 Apr 2022 15:11:03 +0100
Not sure what rtoolwindow is.
 
My idea is that the filter compiler can emit errors, deprecations and warnings/suggestions, of which only the first too should be intrusive (displayed in the filter entry box in red/yellow). To see all messages the user would have to click a button to open a second level with some sort of console (which could also find uses to display runtime errors like integer overflow and division by zero).
 
The change in AND/OR precedence is in [1].
 
[1]https://gitlab.com/wireshark/wireshark/-/merge_requests/6598

On 04/04/22 10:39, Roland Knall wrote:
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

___________________________________________________________________________
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