WG15 Defect Report Ref: 9945-2-86
Topic: backreferences


This is an approved interpretation of 9945-2:1993.

.

Last update: 1997-05-20


								9945-2-86

 _____________________________________________________________________________

	Topic:			backreferences
	Relevant Sections:	2.8.3.3


Defect Report:
-----------------------
	From: Fred Zlotnick <fred@mindcraft.com>


I would like to request an official, binding interpretation from the
WG15 concerning the following point in ISO/IEC 9945-2:1993 (POSIX.2).

In the description of backreferences in POSIX.2 subclause 2.8.3.3,
the standard states (in part):

    The backreference expression \n shall match the same
    (possibly empty) string of characters as was matched by a
    subexpression enclosed between ( and ) preceding
    the n.  The character n shall be a digit from 1 through 9,
    specifying the n'th subexpression...

My question revolves around the use of the word "shall" in the last
sentence.  Is thia a restriction on applications, or on
implementations?  In the former case, an expression with a
backreference such as \0 would be nonportable, having unspecified
behavior.  In the latter case, it would have to be treated as invalid
by any conforming implementation.

Thank you for your attention to this matter.


WG15 response for 9945-2:1993
-----------------------------------

"The character n shall be a digit from 1 throught 9, ..." is a requirement 
for a standard conforming application.  The standard does not require 
that an implementation return an error if another value such as 0 is used.

The standard clearly states behavior for backreference expressions and 
conforming implementations must conform to this.

Rationale
-------------
None.

Forwarded to Interpretations group: 17 Nov 94
Response received: Feb 10 1995
Proposed Resoln forwarded: 13th Feb 1995
Finalised: March 28th 1995
 _____________________________________________________________________________