[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
The following issue has a resolution that has been APPLIED. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: Applied Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text:http://austingroupbugs.net/view.php?id=1128#c4088 Resolution: Accepted As Marked Fixed in Version: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2019-10-31 11:33 UTC == Summary:Where is the ',' (comma) operator ? == Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632 2017-03-17 12:49 kreNote Edited: 0003633 2017-03-17 12:50 kreNote Edited: 0003633 2017-03-17 12:51 kreNote Edited: 0003633 2017-03-17 12:53 shware_systems Note Added: 0003635 2017-03-17 14:07 kreNote Added: 0003637 2017-03-20 01:43 shware_systems Note Added: 0003639 2017-03-20 03:05 kreNote Added: 0003640 2017-03-20 10:20 geoffclare Note Added: 0003641 2017-03-20 10:54 kreNote Added: 0003642 2017-03-20 11:42 joerg Note Added: 0003643 2017-03-20 11:45 geoffclare Note Added: 0003644 2017-03-20 11:56 kreNote Added: 0003645 2017-03-23 13:01 Vincent LefevreNote Added: 0003647 2017-03-23 13:02 Vincent LefevreNote Edited: 0003647 2017-03-23 13:02 Vincent LefevreNote Edited: 0003647 2017-05-06 03:02 kreNote Added: 0003687 2018-08-23 16:15 geoffclare Note Added: 0004088 2018-08-23 16:15 geoffclare Interp Status => --- 2018-08-23 16:15 geoffclare Final Accepted Text => http://austingroupbugs.net/view.php?id=1128#c4088 2018-08-23 16:15 geoffclare Status New => Resolved 2018-08-23 16:15 geoffclare Resolution Open => Accepted As Marked 2018-08-23 16:16 geoffclare Tag Attached: tc3-2008 2019-10-31 11:33 geoffclare Status Resolved => Applied ==
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
The following issue has been RESOLVED. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: Resolved Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text:http://austingroupbugs.net/view.php?id=1128#c4088 Resolution: Accepted As Marked Fixed in Version: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2018-08-23 16:15 UTC == Summary:Where is the ',' (comma) operator ? == Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632 2017-03-17 12:49 kreNote Edited: 0003633 2017-03-17 12:50 kreNote Edited: 0003633 2017-03-17 12:51 kreNote Edited: 0003633 2017-03-17 12:53 shware_systems Note Added: 0003635 2017-03-17 14:07 kreNote Added: 0003637 2017-03-20 01:43 shware_systems Note Added: 0003639 2017-03-20 03:05 kreNote Added: 0003640 2017-03-20 10:20 geoffclare Note Added: 0003641 2017-03-20 10:54 kreNote Added: 0003642 2017-03-20 11:42 joerg Note Added: 0003643 2017-03-20 11:45 geoffclare Note Added: 0003644 2017-03-20 11:56 kreNote Added: 0003645 2017-03-23 13:01 Vincent LefevreNote Added: 0003647 2017-03-23 13:02 Vincent LefevreNote Edited: 0003647 2017-03-23 13:02 Vincent LefevreNote Edited: 0003647 2017-05-06 03:02 kreNote Added: 0003687 2018-08-23 16:15 geoffclare Note Added: 0004088 2018-08-23 16:15 geoffclare Interp Status => --- 2018-08-23 16:15 geoffclare Final Accepted Text => http://austingroupbugs.net/view.php?id=1128#c4088 2018-08-23 16:15 geoffclare Status New => Resolved 2018-08-23 16:15 geoffclare Resolution Open => Accepted As Marked ==
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
A NOTE has been added to this issue. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2018-08-23 16:15 UTC == Summary:Where is the ',' (comma) operator ? == -- (0004088) geoffclare (manager) - 2018-08-23 16:15 http://austingroupbugs.net/view.php?id=1128#c4088 -- On 2016 edition page 2332 line 74119 section 1.1.2.1 add a small-font note:Note: the comma operator (section 6.5.17 of the ISO C standard) is intentionally not included in the table. It need not be supported by implementations. Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632 2017-03-17 12:49 kreNote Edited: 0003633 2017-03-17 12:50 kreNote Edited: 0003633 2017-03-17 12:51 kreNote Edited: 0003633 2017-03-17 12:53 shware_systems Note Added: 0003635 2017-03-17 14:07 kreNote Added: 0003637 2017-03-20 01:43 shware_systems Note Added: 0003639 2017-03-20 03:05 kreNote Added: 0003640 2017-03-20 10:20 geoffclare Note Added: 0003641 2017-03-20 10:54 kreNote Added: 0003642 2017-03-20 11:42 joerg Note Added: 0003643 2017-03-20 11:45 geoffclare Note Added: 0003644 2017-03-20 11:56 kreNote Added: 0003645 2017-03-23 13:01 Vincent LefevreNote Added: 0003647 2017-03-23 13:02 Vincent LefevreNote Edited: 0003647 2017-03-23 13:02 Vincent LefevreNote Edited: 0003647 2017-05-06 03:02 kreNote Added: 0003687 2018-08-23 16:15 geoffclare Note Added: 0004088 ==
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
A NOTE has been added to this issue. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2017-05-06 03:02 UTC == Summary:Where is the ',' (comma) operator ? == -- (0003687) kre (reporter) - 2017-05-06 03:02 http://austingroupbugs.net/view.php?id=1128#c3687 -- For no particular good reason, I have just been pondering the locale and ',' issue, and the problems that are caused by having an operator that is the same as a character that can appear as part of a number in some locales. Then I wondered why only ',' is special for that, I have it on good authority the ants of neptune (they live "underground", and are quite small, so we have not discovered them yet...) use a numeric form in which the '+' character is used to separate units from decimal fractions. (so 1+3 is their equivalent of what in the US/Aust/UK would be 1.3 or 1,3 in much of the non-UK Europe). Perhaps er either need to require that operators in $(( )) expressions all be space separated (as has been stated is required in ksh93 for ',') at least from numeric literals (we control the syntax of var names so there is less of a problem, unless some shell perhaps allows "scientific" notation and we have to deal with that "e" in numbers), or perhaps it might be better to simply require that all sh arithmetic be evaluated in the C locale. Neither solution is suitable for standardisation until implemented of course, so implementers out there might want to consider how they would handle any random locale specificatio, where any character might be the "decimal point" (whatever its proper name is.) Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632 2017-03-17 12:49 kreNote Edited: 0003633 2017-03-17 12:50 kreNote Edited: 0003633 2017-03-17 12:51 kreNote Edited: 0003633 2017-03-17 12:53 shware_systems Note Added: 0003635 2017-03-17 14:07 kreNote Added: 0003637 2017-03-20 01:43 shware_systems Note Added: 0003639 2017-03-20 03:05 kreNote Added: 0003640 2017-03-20 10:20 geoffclare Note Added: 0003641
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
A NOTE has been added to this issue. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2017-03-20 11:45 UTC == Summary:Where is the ',' (comma) operator ? == -- (0003644) geoffclare (manager) - 2017-03-20 11:45 http://austingroupbugs.net/view.php?id=1128#c3644 -- It looks to me like the inclusions and omissions of arithmetic operators in the table were done by entire C standard sub-sections. Thus sizeof is in the table because other unary operators in 6.5.3 are needed. However, cast operators are not in the table because nothing in that sub-section (6.5.4) is needed. The omission of the comma operator fits that pattern because it is in its own sub-section (6.5.17). Control statements are included in the table because they are needed for utilities other than the shell. Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632 2017-03-17 12:49 kreNote Edited: 0003633 2017-03-17 12:50 kreNote Edited: 0003633 2017-03-17 12:51 kreNote Edited: 0003633 2017-03-17 12:53 shware_systems Note Added: 0003635 2017-03-17 14:07 kreNote Added: 0003637 2017-03-20 01:43 shware_systems Note Added: 0003639 2017-03-20 03:05 kreNote Added: 0003640 2017-03-20 10:20 geoffclare Note Added: 0003641 2017-03-20 10:54 kreNote Added: 0003642 2017-03-20 11:42 joerg Note Added: 0003643 2017-03-20 11:45 geoffclare Note Added: 0003644 ==
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
A NOTE has been added to this issue. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2017-03-20 10:54 UTC == Summary:Where is the ',' (comma) operator ? == -- (0003642) kre (reporter) - 2017-03-20 10:54 http://austingroupbugs.net/view.php?id=1128#c3642 -- Re note 3641 .. I don't have access to anything with ksh88, so that was one that was not part of "all variants I could find to test" - though I did assume it might have been there, as pdksh (the ancient bug ridden thing) is supposed to be (or was intended to have been) a ksh88 clone - or so I have read, and it supports ','. But if ',' was deliberately omitted (from the std), why was no mention made of it, sizeof() is deliberately omitted (for excellent, and obvious, reasons) and it is mentioned (one can see that ++ and -- need to be explicitly unspecified as otherwise they may be interpreted as two unary or unary & binary operators in some cases). Control statements (which aren't expressions at all) are also explicitly omitted. But ',' is just ignored??? It is the one plausible operator that is not there anywhere. kre Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632 2017-03-17 12:49 kreNote Edited: 0003633 2017-03-17 12:50 kreNote Edited: 0003633 2017-03-17 12:51 kreNote Edited: 0003633 2017-03-17 12:53 shware_systems Note Added: 0003635 2017-03-17 14:07 kreNote Added: 0003637 2017-03-20 01:43 shware_systems Note Added: 0003639 2017-03-20 03:05 kreNote Added: 0003640 2017-03-20 10:20 geoffclare Note Added: 0003641 2017-03-20 10:54 kreNote Added: 0003642 ==
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
A NOTE has been added to this issue. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2017-03-20 03:05 UTC == Summary:Where is the ',' (comma) operator ? == -- (0003640) kre (reporter) - 2017-03-20 03:05 http://austingroupbugs.net/view.php?id=1128#c3640 -- Mark, you can believe what you want, but the ',' (as a boolean operator, distinct from the ',' which is a syntax element used to separate items in lists of initialisers, declarations, parameters, ...) is an operator in C and has been for a very very long time (I don't (quite) go back far enough to know if it was there in C on day 1, but it certainly is part of ancient K C, from way before it was made portable or anything like that.) PDP-11's (and 7's) had no need of any fancy ALU /CPU side effect maintenance, you did something, and it just happened... So ',' was certainly not added for that ... on the other hand, expressions like x++, x++ are perfectly well defined (unlike x++ + x++ for example), the ',' provides that kins of sequencing. Comma operators are useful all kinds of places where the syntax permits just one expression, but more than one is needed (or desired), as for example in for (count = 0, ptr = list_head; ptr != NULL; ptr = ptr->next, count++) /* whatever code */ The same would be useful in $(( )) in the shell - it allows just a single expression, but sometimes we need more than that, which I assume (apart from just completeness) is why most shells implement it. I still cannot help but believe it was just forgotten - and until someone who really knows says different, I will continue to believe that. Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632 2017-03-17 12:49 kreNote Edited: 0003633 2017-03-17 12:50 kreNote Edited: 0003633 2017-03-17 12:51 kreNote Edited: 0003633 2017-03-17 12:53 shware_systems Note Added: 0003635 2017-03-17 14:07 kreNote Added: 0003637 2017-03-20 01:43 shware_systems Note Added: 0003639 2017-03-20 03:05 kreNote Added: 0003640
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
A NOTE has been added to this issue. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2017-03-20 01:43 UTC == Summary:Where is the ',' (comma) operator ? == -- (0003639) shware_systems (reporter) - 2017-03-20 01:43 http://austingroupbugs.net/view.php?id=1128#c3639 -- C99 6.5.13 to 17 can all be implemented as macros with arguments, but then their names would have to be longer to be mnemonic and couldn't use infix notation. The standard characterizes all of them as operators instead, and since the behavior description is adequate enough to be usable it doesn't really matter for comma that other characterizations may be more precise. The difference I see is &&, and ||, involve a conditional based on the operand values, or a similar one with the left hand side of the ?: triplet; and evaluation of parts of the expression isn't guaranteed. A processor's ALU is involved evaluating the condition, if only to set flags or select a branch target as side effects. They qualify as arithmetic operators because they involve the ALU somehow. Functionally, the comma operator is essentially a NOP that only ensures there aren't pending side effects of an ALU doing speculative or asynchronous executions when the right hand side begins being evaluated, especially if components of the expression are volatile qualified. All parts of the expression get evaluated, however. Its side effects relate to a CPUs' instruction fetch subsystem, not the ALU. For a simple case, it frequently maps to a WAIT instruction on x86s, which has neither operands or result that affect the ALU or FPU registers, as Intel documents it. Parentheses around those operators and operands can affect evaluation precedence also. When used with comma they simply disambiguate it syntactically from being considered a premature end of a function's argument or initialization element rvalue. They function more like curly braces around entire statement blocks than for arithmetic grouping. This is a significant enough difference I consider comma of a different operator class than arithmetic, as token pasting operators in the preprocessor are a different class, but also listed as generic 'operators' in the syntax descriptions. Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632
Rethinking pre/post-increment operators [was: [1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?]
(0003623) stephane (reporter) - 2017-03-17 10:32 http://austingroupbugs.net/view.php?id=1128#c3623 > That's for instance why the spec says it's unspecified (or implementation > defined, I don't remember) whether ++ and -- are supported or not, to tell > applications not to assume $((--a)) is the same as $((- - a)) (as they > could if they had left that bit out). The exact wording is that these are "not required" to be supported. Speaking of which, I don't understand why this is. The {pre,post}-{in,de}crement operators are a very frequently used feature of C-style arithmetics, so users expect them. Implementing these surely is rather trivial. So it seems like an unnecessary annoyance that you cannot rely on these in a cross-platform shell script -- particularly since (as Stéphane points out above) this creates an avoidable ambiguity: $((--a)) and $((++a)) do not have the same meaning on every shell. Are there any reasons for that decision, other than "ksh88 didn't support them", that I may not be aware of? If ksh88 is the reason, then maybe it's time to revisit this. The only current POSIX shells I'm aware of that *don't* support them are Almquist derivatives dash and FreeBSD sh[*]; even Busybox ash added them (as did ksh88 clone pdksh, back in 1993). (Dash silently accepts $((--a)) and $((++a)) as equivalent to $((a)), as did ksh88; FreeBSD sh rejects them.) - M. [*] as well as another Almquist derivative, NetBSD sh, but it is far too obsolete to be considered POSIX in 2017.
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
A NOTE has been added to this issue. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2017-03-17 14:07 UTC == Summary:Where is the ',' (comma) operator ? == -- (0003637) kre (reporter) - 2017-03-17 14:07 http://austingroupbugs.net/view.php?id=1128#c3637 -- Re 3635, you can interpret '&&' the same way if you like, it doesn't do anything with the values of its operands, it just evaluates the one on the left, then possibly evaluates the one on the right, and returns as its value whichever one it evaluated last. ',' evaluates the operand on the left, then unconditionally evaluates the operand on the right, and returns as its result the operand that it evaluated last. What real difference is there? You can also model the && operator with if statements and gotos if that floats your boat, but that doesn't make it anything less an operator. ',' is an operator too, and it jas a result, just as the test you quoted from c99 says it does. Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632 2017-03-17 12:49 kreNote Edited: 0003633 2017-03-17 12:50 kreNote Edited: 0003633 2017-03-17 12:51 kreNote Edited: 0003633 2017-03-17 12:53 shware_systems Note Added: 0003635 2017-03-17 14:07 kreNote Added: 0003637 ==
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
A NOTE has been added to this issue. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2017-03-17 12:53 UTC == Summary:Where is the ',' (comma) operator ? == -- (0003635) shware_systems (reporter) - 2017-03-17 12:53 http://austingroupbugs.net/view.php?id=1128#c3635 -- The way to emulate comma is by a sequence similar to: left-hand-side; goto auto-comma-label; auto-comma-label: result = right-hand-side; >From c99 6.5.17: Then the right operand is evaluated; the result has its type and value. This is why I don't see the ',' as having a result. It is a syntactic macro that generates hidden labels more than actual operator. Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 2017-03-17 12:36 shware_systems Note Edited: 0003632 2017-03-17 12:39 kreNote Added: 0003633 2017-03-17 12:41 kreNote Edited: 0003633 2017-03-17 12:42 shware_systems Note Edited: 0003632 2017-03-17 12:49 kreNote Edited: 0003633 2017-03-17 12:50 kreNote Edited: 0003633 2017-03-17 12:51 kreNote Edited: 0003633 2017-03-17 12:53 shware_systems Note Added: 0003635 ==
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
A NOTE has been added to this issue. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2017-03-17 12:21 UTC == Summary:Where is the ',' (comma) operator ? == -- (0003632) shware_systems (reporter) - 2017-03-17 12:21 http://austingroupbugs.net/view.php?id=1128#c3632 -- I don't see the comma operator as intended to be included. It is a statement grouping operator to disambiguate sequence points without having to use extra goto statements in C blocks so a ';' indicates an explicit sequence point. It is an operator, but not an arithmetic one that returns a result. Any result is a consequence of the expression following the ',', not of the operator itself. As goto's are excluded, it follows ',' is also intended to be excluded; unless a future shell becomes sequence point sensitive. That it is described with the arithmetic operators rather than by itself is similar to how typedef is listed as a storage class specifier, for (histo)hysterical reasons. Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 2017-03-17 10:32 stephane Note Added: 0003623 2017-03-17 10:32 stephane Note Edited: 0003623 2017-03-17 10:59 joerg Note Added: 0003626 2017-03-17 11:30 stephane Note Added: 0003627 2017-03-17 11:31 kreNote Added: 0003628 2017-03-17 11:40 stephane Note Edited: 0003627 2017-03-17 12:13 stephane Note Added: 0003631 2017-03-17 12:21 shware_systems Note Added: 0003632 ==
[1003.1(2013)/Issue7+TC1 0001128]: Where is the ',' (comma) operator ?
The following issue has been SUBMITTED. == http://austingroupbugs.net/view.php?id=1128 == Reported By:kre Assigned To: == Project:1003.1(2013)/Issue7+TC1 Issue ID: 1128 Category: Shell and Utilities Type: Omission Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:1.1.2.1, 2.6.4 Page Number:2331-3, 2358-9 Line Number:74118-74162, 75225-75250 Interp Status: --- Final Accepted Text: == Date Submitted: 2017-03-17 01:08 UTC Last Modified: 2017-03-17 01:08 UTC == Summary:Where is the ',' (comma) operator ? Description: First, apologies if this has been raised before, I looked, but did not see anything (and as it is not fixed, I would tend to guess it has not been.) Table 1-2, and section 2.6.4 make no mention at all of C's ',' operator. Some shells appear to implement that (perhaps most shells) but some do not. Is it intended to be supported, or not? Desired Action: Add a row to Table 1-2 listing ',' Add text to 2.6.4 indicating whether or not implementation of ',' in arithmetic expressions is required/forbidden/optional. == Issue History Date ModifiedUsername FieldChange == 2017-03-17 01:08 kreNew Issue 2017-03-17 01:08 kreName => Robert Elz 2017-03-17 01:08 kreSection => 1.1.2.1, 2.6.4 2017-03-17 01:08 krePage Number => 2331-3, 2358-9 2017-03-17 01:08 kreLine Number => 74118-74162, 75225-75250 ==