Ich hab hier folgende Routinen :
Code: Alles auswählen
Procedure TIrgendwas.WriteBytes(Const data: Array Of Byte);
procedure TIrgendwas2.WriteByteArr(const Data: TBytes);
Darf ich das so machen ? (Der Compiler akzeptiert es, zumindest)
Code: Alles auswählen
Procedure TIrgendwas.WriteBytes(Const data: Array Of Byte);
begin
InstanzvonTIrgendwas2.WriteBytes(@data[0]);
end;
v1:
Code: Alles auswählen
Procedure TIrgendwas.WriteBytes(Const data: Array Of Byte);
Var
b: TBytes;
Begin
setlength(b, length(data));
Move(data[0], b, length(data));
InstanzvonTIrgendwas2.WriteByteArr(b);
setlength(b, 0);
end;
Code: Alles auswählen
Procedure TIrgendwas.WriteBytes(Const data: Array Of Byte);
Var
b: TBytes;
i:integer;
Begin
setlength(b, length(data));
for i := low(data) to high(data) do
b[i-low(data)] := data[i];
InstanzvonTIrgendwas2.WriteByteArr(b);
setlength(b, 0);
end;