Peter Gerwinski wrote:
- Field widths now default to left-justified output.
Did I miss a discussion on this? Doesn't this break a lot of programs? Or is this with "--borland-pascal"?
Perhaps my formulation was misleading: I mean that
writeln ( 123 );
will no more yield the output
_______123
(with seven blanks), but instead
123
(left-justified). To produce "_______123" you must explicitly say "writeln ( 123 : 10 );".
Perhaps you should write "field width now defaults to 0" (or 1 - what is it?). By "left justified" I would mean "123_______".
Since Phil mentioned why the default was a bigger width, I now think this should be toggled by the --borland-pascal switch, and a separate switch as well. E.g., I try to make my programs not dependent on the --borland-pascal switch, but this problem (together with the "clipping" in standard Pascal) would require a lot of changes that I can't do soon...
BTW: Phil, how do you output a number without spaces (or, let's say with exactly one space) in standard Pascal, e.g. to write the simple line "There are 7 items" (with 7 being the value of a variable)? With no (or a big) format specifier, there would be more spaces than wanted, with a small format specifer, large numbers would be cut.
Or does this "clipping" only apply to strings? But then again, how would you do "You name is Phil."? Do you have to "write(s:Length(s))" or such?
BTW: Phil, how do you output a number without spaces (or, let's say with exactly one space) in standard Pascal, e.g. to write the simple line N"There are 7 items" (with 7 being the value of a variable)? With no (or a big) format specifier, there would be more spaces than wanted, with a small format specifer, large numbers would be cut.
write ('There are ', items:1, ' items')
Or does this "clipping" only apply to strings?
Clipping only applies to strings.
But then again, how would you do "You name is Phil."? Do you have to "write(s:Length(s))" or such?
write ('You name is Phil.') :)
In standard Pascal there are no string schema types like extended Pascal, but in extended Pascal "write(s)" is identical to "write(s:length(s))".
"Strings" in standard Pascal are typically an "array [1 .. n] of char". The programmer then needs to keep track of how many of the n characters are valid. Then the write statement would look like "write (s:sizeofs)".