[fpc-pascal] Food for thought - language string improvement

Bernd Oppolzer bernd.oppolzer at t-online.de
Thu Jul 6 19:27:39 CEST 2017


Am 06.07.2017 um 18:32 schrieb Andreas:
>
> For this reason I would be against this implementation. Maybe taking 
> away the need for the + sign at the end of the line. The strings are 
> concatenated until a semi-colon or other symbol is encountered

This is what the (new) Stanford Pascal compiler does:

program TESTLSTR ( OUTPUT ) ;

var ZEILE : array [ 1 .. 200 ] of CHAR ;
     I : INTEGER ;

begin (* HAUPTPROGRAMM *)
   ZEILE := 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
            'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
            'cccccccccccccccccccccccccccccccccccc'
            'dddddddddddddddddddddddddddddddddddd'
            'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' ;
   WRITELN ( ZEILE ) ;
   MEMSET ( ADDR ( ZEILE ) , 'b' , 200 ) ;
   WRITELN ( ZEILE ) ;
   for I := 1 to 200 do
     ZEILE [ I ] := '=' ;
   WRITELN ( ZEILE ) ;
end (* HAUPTPROGRAMM *) .

that is: long strings may be concatenated simply by closing
the string constant on one line and reopening it on the next line.

http://bernd-oppolzer.de/job9.htm

HTH, kind regards

Bernd




More information about the fpc-pascal mailing list