CBFalconer wrote:
Waldek Hebisch wrote:
... snip ...
No, all elements of `Test' have well-defined value. It is standard: `Test' is padded with blanks to the full length (so all positions from 12 to 256 contain blanks). GPC `write' strips trailing blanks.
Does it? That's news to me. ;-) The code in predef.c uses `length = PASCAL_STRING_LENGTH (p);' and for fixed-strings, PASCAL_STRING_LENGTH takes the length of the array as declared, without trimming any blanks. The following program (compiled with or without `--classic-pascal') seems to confirm this.
program foo (Output);
var a: packed array [1 .. 10] of Char;
begin a := 'x '; Write (a, '.') end.
That would make it rather hard to move to an appropriate column with:
write(' ');
or even: write(' ' : 5); or: i := 5; write(' ' : i);
all of which have applications.
Indeed. These things should work. I'm adding a test (chuck7.pas) which currently works, to ensure it will keep working.
So the only thing that hangs together for me is for writeln to do the trailing blank stripping. Even this will make it hard to erase a line on a simple terminal.
Yes, or to write text files with trailing spaces (for whatever reason one might want to do so), so I won't do this.
Frank