[fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

Ben Grasset operator97 at gmail.com
Fri Jul 5 17:48:04 CEST 2019


On Fri, Jul 5, 2019 at 11:35 AM Ben Grasset <operator97 at gmail.com> wrote:

> On Fri, Jul 5, 2019 at 11:29 AM Ryan Joseph <genericptr at gmail.com> wrote:
>
>> This may not be related but why does "l: string = lines;” work, shouldn’t
>> that be an error or at least get clipped? I’m seeing writeln prints out the
>> entire string as if it was an ansistring.
>>
>
> Your example has nothing to do with multi-line strings specifically, and
> is completely normal, expected behavior when in {$H+}.
>
> You could write the exact same constant string with single-line strings
> using the "addition operators and sLineBreak" method, and assign it to the
> variable the exact same way, and it would display identically.
>

Also, note that in all cases "untyped" constant strings behave exactly like
ShortStrings or AnsiStrings, depending on whether {$H+} is being used, in
every way (meaning, they can be passed *directly* to WriteLn with no
intermediate variable required.) The only significant difference is that
they are immutable, embedded-in-the-executable "true" constants.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190705/c7ef57c1/attachment.html>


More information about the fpc-devel mailing list