A NOTE has been added to this issue. ====================================================================== https://www.austingroupbugs.net/view.php?id=1914 ====================================================================== Reported By: rillig Assigned To: ====================================================================== Project: 1003.1(2024)/Issue8 Issue ID: 1914 Category: Shell and Utilities Type: Clarification Requested Severity: Editorial Priority: normal Status: New Name: Roland Illig Organization: User Reference: Section: Issue 8, Volume 3, expr Page Number: 2916 Line Number: 97319, 97321 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2025-03-15 16:20 UTC Last Modified: 2025-03-20 09:42 UTC ====================================================================== Summary: expr: short-circuit evaluation ======================================================================
---------------------------------------------------------------------- (0007127) geoffclare (manager) - 2025-03-20 09:42 https://www.austingroupbugs.net/view.php?id=1914#c7127 ---------------------------------------------------------------------- Ah yes, I hadn't thought of an error message as a possible "side effect". If implementations differ on whether they evaluate expr2, I suggest we make it explicitly unspecified. Suggested changes... On page 2916 line 97320 section expr, add a sentence in "Description" column for "&":<blockquote>If <i>expr1</i> is null or zero, it is unspecified whether <i>expr2</i> is evaluated.</blockquote> On page 2916 line 97323 section expr, add a sentence in "Description" column for "|":<blockquote>If <i>expr1</i> is neither null nor zero, it is unspecified whether <i>expr2</i> is evaluated.</blockquote> After page 2919 line 97410 section expr (RATIONALE), add a paragraph:<blockquote>Implementations differ as to whether the '&' and '|' operators ``short-circuit'' (that is, whether they evaluate <i>expr2</i> if the return value can be deduced from evaluating just <i>expr1</i>). Consequently, the observed behavior may differ when evaluating <i>expr2</i> would cause an error (or a signal), such as dividing by zero.</blockquote> Issue History Date Modified Username Field Change ====================================================================== 2025-03-15 16:20 rillig New Issue 2025-03-18 10:05 geoffclare Note Added: 0007121 2025-03-18 18:45 rillig Note Added: 0007126 2025-03-20 09:42 geoffclare Note Added: 0007127 ======================================================================