On 17 Mar 2002 at 13:16, Martin Liddle wrote:
I have just moved to RC 3. Looking at the list of fixed bugs it is obvious that a lot of work has been done in the last few months; thanks to all concerned. The stricter type checking required a lot of effort to get our code to compile but in fairness did highlight a number of problems in our code; so I think it was time well spent. However I am now stuck because of the following problem:
Program WriteTest;
Procedure ZWriteln(AString:String); Begin AString:=AString+'ML'; Writeln('String [',AString,'] Length is ',Length(AString)); End;
Begin ZWriteln(' '); End.
What I see is that length is reported as 1 i.e. the string concatenation is failing. Is this expected behaviour or a bug?
It is a bug alright. If you pass a string variable rather than a literal to 'ZWriteln', the concatentation is successful. So, something seems to have gone awry somewhere.
I also note that trying to set the Capacity of a string schema is now flagged as an error.
My understanding that it should always have been flagged as an error.
Is there an "official" way to set the capacity? We were only setting the capacity as a workaround for problems in previous versions of gpc where under various circumstances it wasn't initialised properly. My first stab is to comment out all the places where we were setting capacity but I can't test if everything is OK because of the problem noted above.
'SetLength' should work. However, I am not sure that you can use it for increasing (as opposed to decreasing) the maximum length of a string.
I am not sure what your original problems were. I haven't experienced any problems with strings (as long as you actually initialise the variables (e.g., s := '') at some point, and don't expect the compiler to do it automatically).
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~African_Chief email: African_Chief@bigfoot.com