On Thu, 22 Nov 2007, Scott Moore wrote:
Russell Whitaker wrote:
On Thu, 22 Nov 2007, Scott Moore wrote:
=============================================================================== C:\GPC\usr\test>gpc -Wno-warnings -o fails fails.pas
C:\GPC\usr\test>fails 1 10 100 2147483647 True False ===============================================================================
This appears to indicate the default fields for integer is set to 1.
As I see it, the default length is not 1, per se, but the length necessary to print the value as a string.
I'm sure it is a reasonable implementation. However, it does not match the ISO 7185 standard.
Earlier today googled for iso7185 and iso10206:
ISO/IEC 7185:1990(E), in section 6.9.3.1:
"Write(f,e) shall be equivalent to the form write(f,e : TotalWidth), using a default value for TotalWidth that depends on the type of e for integer-type, real-type, and Boolean-type, the default values shall be implementation-defined."
ISO10206 has the same text but re-numbered to 6.10.3.1
I'd like to point out that if you made the TotalWidth default to 10 for integers and used the default then you would get leading spaces for numbers less than 10 digits, or sign + nine.
That suggests if you wanted the original behavior, you may need something like write(f,e:length(e))
Do you really want that behavior?
Russ