[fpc-devel] FPC 2.3.1 SVN 8427: new compilation error.

Bruce Tulloch bruce at causal.com
Wed Sep 12 02:13:12 CEST 2007


Michael Schnell wrote:
> 
>>>
>>> FPC 2.1.4, Delphi6 and Kylix3 don't complain.
> FAIK, Delphi does not like Properties as var parameters.

Agreed, this makes sense. However the codebase I'm porting
passes properties to EOF all over the place and this has
compiled and run in Delphi6 and Kylix3 for some years.

It worked in FPC too, until I moved to 2.3.1.

Presumably this suggests Borland cut some corners with the
validity of properties as var arguments or took some liberty
with the definition of EOF or the Text/TextFile types.

Checking Kylix I've found that that unless the property of
type TextFile is defined as a direct reference to a field
of type TextFile, Kylix barfs. Indeed Kylix reports that
TextFile is an "Invalid function result type" if one tries
to return one via a property access method.

So, it would seem this is suspect in Borland's implementation
and I will fix our code to avoid passing properties as var
parameters everywhere I come across it in the ported code.

I agree it's not (should not) be a valid thing to do!

Thanks for the feedback.

Cheers, Bruce.





More information about the fpc-devel mailing list