View Issue Details

IDProjectCategoryView StatusLast Update
00012301003.1(2016/18)/Issue7+TC2Shell and Utilitiespublic2024-06-11 09:08
Reportergavin_howard Assigned To 
PrioritynormalSeverityCommentTypeOmission
Status ClosedResolutionAccepted As Marked 
NameGavin Howard
Organization
User Reference
Sectionbc(1)
Page Number2526-2538
Line Number81596-81614
Interp Status---
Final Accepted TextSee 0001230:0004267.
Summary0001230: Require bc implementations to allow arrays as last parameter
DescriptionPOSIX does not require bc implementations to allow arrays as the last parameter to a function. As the rationale says, "Historical implementations of bc did not allow array parameters to be passed as the last parameter to a function. New implementations are encouraged to remove this restriction even though it is not required by the grammar."

This is a suggestion that 18 years is, in fact, enough "encouragement" to remove the restriction and that it is time to require its removal.

In addition, there are at least two known implementations that have removed this restriction, so it can be said that some "historical implementations" have updated. Thus, the standard can be updated as well.
Desired ActionIn section `bc`:

On page 2526:

* Change line 81596 to:

                     | define_list

* Remove lines 81598-81600
* Between lines 81613 and 81614, add the following line:

                     | LETTER '[' ']'

On page 2538:

* Remove lines 82101-82103
* If desired, replace the above lines with the following:

Historical implementations of bc did not allow array parameters to be passed as the last parameter to a function. When bc was first standardized in Issue 4, this behavior was allowed. To make bc more widely useful, and because there are implementations without this restriction, the allowance for the restriction has been removed.
Tagstc3-2008

Activities

shware_systems

2019-02-25 15:58

reporter   bugnote:0004264

Last edited: 2019-02-25 16:48

I've no objection to the removal, but procedurally I believe for Issue 8 we can only announce it will become a requirement, as a formal Future Direction, and make it a new requirement for Issue 9; to give those implementations that haven't done the change already time to make the change without affecting conformance status.

joerg

2019-02-25 16:29

reporter   bugnote:0004265

Please add a test program that allows to check whether an implementation
supports array arguments the way you like it.

gavin_howard

2019-02-25 19:45

reporter   bugnote:0004267

After the teleconference, the desired actions should be as follows:

In section `bc`:

On page 2526:

* Change line 81591 to:

function : Define LETTER '(' opt_define_list ')'

* Change lines 81595 and 81596 to:

opt_define_list : /* empty */
                     | define_list

* Remove lines 81598-81600
* Between lines 81613 and 81614, add the following lines:

                     | expression ',' argument_list
                     | LETTER '[' ']'

On page 2534:

Change line 81919 to:

define LETTER ( opt_define_list ) {

On page 2538:

* Remove lines 82101-82103 and replace with the following:

Historical implementations of bc did not allow array parameters to be passed as the last parameter to a function. When bc was first standardized in Issue 4, this restriction was allowed. To make bc more widely useful, and because there are implementations without this restriction, the allowance for the restriction has been removed.

gavin_howard

2019-02-25 19:58

reporter   bugnote:0004268

Here is a script to test implementations for conformance to the new change:

define r(l, a[]) {
    auto i
    "Reading array a[]...
"
    for (i = 0; i < l; ++i) {
        a[i]
    }
}

define w(l, a[]) {
    auto i
    "Reading and writing array a[]...
"
    for (i = 0; i < l; ++i) {
        a[i] = i
    }
    for (i = 0; i < l; ++i) {
        a[i]
    }
}

a[0] = 819
a[1] = 89
a[2] = 238
a[3] = 19
a[4] = 38.02
a[5] = -1
a[6] = 29
a[7] = -39
a[8] = -291
a[9] = -2.92
a[10] = 82
a[11] = -23
a[12] = -392.39
a[13] = 298
a[14] = -29
a[15] = -2981

r(16, a[])
w(16, a[])

Issue History

Date Modified Username Field Change
2019-02-21 17:30 gavin_howard New Issue
2019-02-21 17:30 gavin_howard Name => Gavin Howard
2019-02-21 17:30 gavin_howard Section => bc(1)
2019-02-21 17:30 gavin_howard Page Number => 2526-2538
2019-02-21 17:30 gavin_howard Line Number => 81596-81614
2019-02-25 15:58 shware_systems Note Added: 0004264
2019-02-25 16:29 joerg Note Added: 0004265
2019-02-25 16:48 shware_systems Note Edited: 0004264
2019-02-25 19:45 gavin_howard Note Added: 0004267
2019-02-25 19:58 gavin_howard Note Added: 0004268
2019-02-28 16:16 Don Cragun Interp Status => ---
2019-02-28 16:16 Don Cragun Final Accepted Text => See 0001230:0004267.
2019-02-28 16:16 Don Cragun Status New => Resolved
2019-02-28 16:16 Don Cragun Resolution Open => Accepted As Marked
2019-02-28 16:17 Don Cragun Tag Attached: tc3-2008
2019-11-14 14:30 geoffclare Status Resolved => Applied
2024-06-11 09:08 agadmin Status Applied => Closed