Zu der Zeile:
Code: Alles auswählen
operator := (const a:integer) result:GNZTyp;
Code: Alles auswählen
gnurz.pas(104,12) Fatal: Syntax error, "=" expected but ":=" found
Code: Alles auswählen
operator := (const a:integer) result:GNZTyp;
Code: Alles auswählen
gnurz.pas(104,12) Fatal: Syntax error, "=" expected but ":=" found
Code: Alles auswählen
GNZTyp=Record end;
operator := (const a:integer) res:GNZTyp;
Code: Alles auswählen
GNZTyp = array of dword;
Ich habe nun eine neue Unit für die Operatoren erstellt. Nun bekomme ich andere Fehlermeldungen, denen das "result" wohl wirklich nicht gefällt.theo hat geschrieben:"Result" würde ich da nicht nehmen.
Code: Alles auswählen
operator:=(const a: dword) res: GNZTyp;
begin
result:=TGnurz.WordToGNZTyp(a);
end;
Code: Alles auswählen
var
BlaBlubb: TGnurz
// ...
operator:=(const a: dword) res: GNZTyp;
begin
res:=BlaBlubb.WordToGNZTyp(a);
end;
//...
initialization
BlaBlubb := TGnurz.Create;
finalization
FreeAndNil(BlaBlubb);
Code: Alles auswählen
type
TGnurz = class
//...
public
class function WordToGNZTyp(a: dword): GNZTyp;
end;
//...
m.fuchs hat geschrieben:
- Du definierst res und weist dann result. Das könnte vielleicht sogar klappen, wenn es bei Operatoren ähnlich wie bei Funktionen ist und eine magische Variable Result existiert.
Free Pascal Language Reference Guide hat geschrieben:Remark: When compiling in Delphi mode or Objfpc mode, the result identifier may be dropped. The result can then be accessed through the standard Result symbol.
(http://www.freepascal.org/docs-html/ref/refse85.html)
Code: Alles auswählen
operator:=(const a: dword) res: GNZTyp;
begin
res:=TGnurz.Create(..);
res.WordToGNZTyp(a);
end;