Austin Group Defect Tracker

Aardvark Mark III


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001230 [1003.1(2016)/Issue7+TC2] Shell and Utilities Comment Omission 2019-02-21 17:30 2019-02-28 16:16
Reporter gavin_howard View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Resolved  
Name Gavin Howard
Organization
User Reference
Section bc(1)
Page Number 2526-2538
Line Number 81596-81614
Interp Status ---
Final Accepted Text See Note: 0004267.
Summary 0001230: Require bc implementations to allow arrays as last parameter
Description POSIX 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 Action In 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.
Tags tc3-2008
Attached Files

- Relationships

-  Notes
(0004264)
shware_systems (reporter)
2019-02-25 15:58
edited on: 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.

(0004265)
joerg (reporter)
2019-02-25 16:29

Please add a test program that allows to check whether an implementation
supports array arguments the way you like it.
(0004267)
gavin_howard (reporter)
2019-02-25 19:45

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.
(0004268)
gavin_howard (reporter)
2019-02-25 19:58

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 Note: 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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker