[fpc-devel] C style operator doesn't work with properties in 2.3.1
Graeme Geldenhuys
graemeg.lists at gmail.com
Wed Jul 16 16:23:22 CEST 2008
Hi,
After our discussion about not being able to use Include() with a
class property, I thought I would then use the C Style += operator.
After all that boils down to: i += 2; >>>>> i := i + 2;
I tried it, and yes I did add the -Sc compiler parameter...
The error message....
Free Pascal Compiler version 2.3.1 [2008/07/16] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Linux for i386
Compiling guitestrunner_fpgui.pas
Compiling fpg_guitestrunner.pas
/home/graemeg/programming/fpgui.wc/examples/apps/fpcunit/fpg_guitestrunner.pas(207,15)
Error: Variable identifier expected
/home/graemeg/programming/fpgui.wc/examples/apps/fpcunit/fpg_guitestrunner.pas(208,24)
Error: Variable identifier expected
/home/graemeg/programming/fpgui.wc/examples/apps/fpcunit/fpg_guitestrunner.pas(636)
Fatal: There were 2 errors compiling module, stopping
And the code....
-----------------------------------
type
// introduced to test += operator
TMyOb = class(TObject)
private
FValue: integer;
public
property Value: integer read FValue write FValue;
end;
procedure TGUITestRunnerForm.EndTest(ATest: TTest);
var
i: integer; // both of these are simply
o: TMyOb; // to test the += operator
begin
i := 0;
i += 2; // no problems
o := TMyob.Create;
o.Value := 0;
o.Value += 2; // Fails here
pbName1.Position += 1; // <<=== Fails here, o object wasn't used
-----------------------------------
So it seems I can't use the += operator with properties either!! :-(
I'm using FPC 2.3.1 updated today.
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the fpc-devel
mailing list