Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2003-11

FYI: array constructor & string

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Johannes Berg

Hi,

I couldn't compile anything with the following:

procedure x(const a:array of const);
var s:string; // ansistring or shortstring doesn't matter
x([s]);

and tracked it down to the second change block of: http://www.freepascal.org/cgi-bin/viewcvs.cgi/fpc/compiler/nld.pas.diff?r1=1.116&r2=1.117

I put in
stringdef :

     hp.left:=ctypeconvnode.create(hp.left,cansistringtype);

I doubt that this is the correct fix, it does however (properly?) compile above example after this change (with both shortstring and ansistring).

johannes

http://www.sipsolutions.de/ GnuPG key: http://www.sipsolutions.de/keys/JohannesBerg.asc Key-ID: 9AB78CA5 Johannes Berg Fingerprint = AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5

Reply by email

Peter Vreman
to Johannes Berg
Show quoted text 18 lines
Hi, I couldn't compile anything with the following: procedure x(const a:array of const); var s:string; // ansistring or shortstring doesn't matter x([s]); and tracked it down to the second change block of: http://www.freepascal.org/cgi-bin/viewcvs.cgi/fpc/compiler/nld.pas.diff?r1=1.116&r2=1.117 I put in stringdef : hp.left:=ctypeconvnode.create(hp.left,cansistringtype); I doubt that this is the correct fix, it does however (properly?) compile above example after this change (with both shortstring and ansistring).

The correct fix is even smaller:

--- nld.pas.bak Mon Nov 24 02:02:20 2003
+++ nld.pas Wed Nov 26 15:11:16 2003
@@ -1027,6 +1027,7 @@

                      hp.left:=ctypeconvnode.create(hp.left,pbestrealtype^);
                    procvardef :
                      hp.left:=ctypeconvnode.create(hp.left,voidpointertype);

+ stringdef,
variantdef,
pointerdef,
classrefdef,

Reply by email

Michael Van Canneyt
to Peter Vreman
Peter Vreman wrote 31 lines
> Hi, > > I couldn't compile anything with the following: > > procedure x(const a:array of const); > var s:string; // ansistring or shortstring doesn't matter > x([s]); > > and tracked it down to the second change block of: > http://www.freepascal.org/cgi-bin/viewcvs.cgi/fpc/compiler/nld.pas.diff?r1=1.116&r2=1.117 > > I put in > stringdef : > hp.left:=ctypeconvnode.create(hp.left,cansistringtype); > > I doubt that this is the correct fix, it does however (properly?) > compile above example after this change (with both shortstring and > ansistring). The correct fix is even smaller: --- nld.pas.bak Mon Nov 24 02:02:20 2003 +++ nld.pas Wed Nov 26 15:11:16 2003 @@ -1027,6 +1027,7 @@ hp.left:=ctypeconvnode.create(hp.left,pbestrealtype^); procvardef : hp.left:=ctypeconvnode.create(hp.left,voidpointertype); + stringdef, variantdef, pointerdef, classrefdef,

Applied.

Michael.

Reply by email