[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #59973] [PATCH] implement .soquiet and .msoquiet requests
From: |
G. Branden Robinson |
Subject: |
[bug #59973] [PATCH] implement .soquiet and .msoquiet requests |
Date: |
Thu, 8 Apr 2021 21:31:42 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 |
Update of bug #59973 (project groff):
Status: Need Info => In Progress
_______________________________________________________
Follow-up Comment #5:
Hi Dave,
[comment #3 comment #3:]
> Your "while" (non)loop expressed in pseudocode is:
>
> while (1) {
> if (A)
> if (B)
> break;
> error(...);
> break;
> }
>
> Neither "if" having an "else," this should be equivalent to:
>
> while (1) {
> if (A && B)
> break;
> error(...);
> break;
> }
>
> This further seems to be equivalent to the lower-level pseudocode:
>
> if (A && B)
> goto NEXT;
> error(...)
> goto NEXT;
> NEXT:
>
> which basically reduces to:
>
> if !(A && B)
> error(...)
>
> I confess I'm no C++ coder, so I could be overlooking any number of
language-specific gotchas. And I don't know what you mean by "complicating
the boolean conditional afterward," the thing you were trying to avoid. But
naively tracing the code path, I don't understand the need for the "while" at
all.
You are completely correct. I suspect, and an indentation error on the same
reinforces this, that I had something even more complicated originally.
I've refactored to:
if (!(quietly && (ENOENT == errno)))
One could of course apply De Morgan's Law here, but I think the intent is
clearer this way.
As you can see, I've also chosen not to worry about EACCES at this point.
This facilitates further simplification of the logic--and, as you note, that
error might indicate something actually unexpected.
If we ever need to handle other POSIX errno symbols, I would extend the
request to take a list of such strings. In fact, .so and .mso themselves
could be extended in this way... But I do not do so at present because I don't
know if there is demand for such a feature. This one has 2 practical use
cases as noted in the original ticket.
Next, update the documentation for these new requests.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59973>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #59973] [PATCH] implement .soquiet and .msoquiet requests,
G. Branden Robinson <=