[fpc-pascal] What's wrong with this simple test program

Ralf Quint freedos.la at gmail.com
Fri Dec 19 21:58:05 CET 2014


On 12/19/2014 12:53 PM, Joost van der Sluis wrote:
> On 12/19/2014 09:48 PM, Ralf Quint wrote:
>> I have been trying to use tStringList in a larger project of mine, but
>> this just keeps bombing out with a exception.
>> I have been able to reproduce the problem with this very simple test
>> program:
>>
>> program project1;
>>
>> USES Classes;
>>
>> Var T : tStringList;
>>      S : String;
>> begin
>>    S := 'Test';
>>    T.Create;
>> // T.Clear;
>>    T.Add (S);
>>    T.Free;
>> end.
>
> You're mixing old TP-style objects with classes.
>
> T := TStringList.Create is the correct syntax.
Well, then why is the compiler building this just fine without even 
throwing an error?!?!?
As mentioned, I do not get the error at the .Create call, but at 
anything after that...
I do not have a working Delphi system at hand right now, but I am sure 
that this would have compiled and worked on anything up to Delphi 2006 
just fine.

I will change this and see if this makes a difference, thanks

Ralf

---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com




More information about the fpc-pascal mailing list