WG15 Defect Report Ref: 9945-2-76
Topic: bc large numbers and lines

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


Last update: 1997-05-20



	Topic:			bc large numbers and lines
	Relevant Sections:	4.3

Defect Report:

Date: Sat, 3 Sep 1994 15:36:12 -0700
From: Fred Zlotnick <fred@mindcraft.com>

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

POSIX.2 Subclause 4.3 specifies the semantics of the "bc" utility.  In
subclause, lines 1385-1387 state:

	Very large numbers shall be split across lines with 70
	characters per line in the POSIX locale; other locales
	may split at different character boundaries.  Lines that
	are continued shall end with a backslash.

The issue that I would like resolved is: does either the terminating
backslash, or the newline, or both, count against the 70 characters in
the continued line?  In other words, in the POSIX locale, if "bc" needs
to display an integer longer than 70 digits, how many digit characters
are displayed before the backslash on the first line?

I note that the definition of a "line" in POSIX.2 subclause is

	A sequence of text consisting of zero or more non-<newline>
	characters plus a terminating <newline> character.

>From this definition I would conclude that the newline is counted as
one of the 70 characters.  Thus my understanding of the standard is
that under the circumstances described above "bc" would display 68
digits followed by a backslash followed by a newline followed by the
remaining digits (split across more lines if necessary).

Thank you for your attention to this matter.

Interpretation response:

The definition of line includes the newline character, and bc does not override 
that definition, therefore the <backslash> and <newline> characters are 
counted as part of the 70 length.

The standard clearly states the behaviour for bc and the definition of 
a line, and conforming implementations must conform to this.

Note that this is a change to historical practice.

Forwarded to Interpretations group: 4 Sep 94

Proposed resolution sent for review: 19th Nov 94
Resolved: 10th Dec 94