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

Sven Barth pascaldragon at googlemail.com
Fri Jul 5 19:34:12 CEST 2019


Ryan Joseph <genericptr at gmail.com> schrieb am Fr., 5. Juli 2019, 19:14:

>
>
> > On Jul 5, 2019, at 12:10 PM, Ben Grasset <operator97 at gmail.com> wrote:
> >
> > Explicit "ShortString" variables are still exactly what they say they
> are in all cases though, of course.
> >
>
> This may present a bit of problem then because you don't appear to be able
> to opt-in to long strings just for constants. $h+ will always be required
> for multi-line strings but I don’t want the rest of my “string” types to
> turn into ansistrings. Is there any solution to this?
>

Why should they always be required? If your multiline string is shorter
than 256 characters then all is well.

And otherwise you'd have the same problem with an ordinary string constant.

So this behaves exactly as expected and desired.

You can also declare your string as a typed AnsiString constant in $H- mode:

lines: AnsiString = `lorem ipsum`;

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190705/4ddee5d6/attachment.html>


More information about the fpc-devel mailing list