Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
214 Beiträge
 
#9

AW: Code Umstellung von D7 auf D11.3

  Alt 15. Nov 2023, 11:52
bin mal ein bisserl naiv, könnte es denn mit demda funktionieren (hab' halt nur D7 und da geht das)?
Delphi-Quellcode:
type TMyColors = Array of TColor;

procedure Foo(const colors);
var
  i : Integer;
begin
  for i := low(tMyColors(Colors)) to high(tMyColors(colors)) do
   tMyColors(Colors)[i] := clBlack;
end;

procedure DoIt;
var
  Colors : TMyColors;
begin
  SetLength(Colors,10);
  foo(Colors);
end;
That is perfectly fine and will work, though very not recommended, because after all that, just declare the type, don't leave it untyped, and you will never have a problem with any compiler.
  Mit Zitat antworten Zitat