Autor Beitrag
reimo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75



BeitragVerfasst: Do 26.07.07 07:15 
Hi!

Möchte einige constanten eines recordstyps definíeren, welcher eine variablendefinition eines dynamischen arraytyps enthält.
Bsp:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
type
   TCfg = record
      string1: string;
      stringarray:array of string;
   end;


jetzt würd ich gerne einige constanten dieses typs definieren! mein problem ist aber das dynamische stringarray!
wie mach ich sowas? ist das überhaupt möglich?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
const
   c1: TCfg = (
      string1: 'test';
      stringarray: '1', '2', '3';          // wie weise ich die werte dem dynamischen stringarray zu???
   );

   c2: TCfg = (
      string1: 'test2';
      stringarray: '1', '2', '3', '4', '5'; // wie weise ich die werte dem dynamischen stringarray zu???
   );


ist sowas möglich???? wenn ja, wie?

danke!

Moderiert von user profile iconGausi: Quote- durch Delphi-Tags ersetzt
Stefan.Buchholtz
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 612

WIN 2000, WIN XP, Mac OS X
D7 Enterprise, XCode, Eclipse, Ruby On Rails
BeitragVerfasst: Do 26.07.07 08:01 
Nein, das ist so nicht möglich. Konstante Arrays brauchen eine feste Längenangabe.

Stefan

_________________
Ein Computer ohne Windows ist wie eine Schokoladentorte ohne Senf.
passiv
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 270

WIN XP Professional
Delphi 7 Enterprise, Java (Eclipse), Python 2.5, Django 1.1
BeitragVerfasst: Do 26.07.07 08:04 
dynamisch heißt ja, dass du im laufenden programm die länge verändern kannst, was dann den eigenschaften einer Konstanten widersprechen würde

_________________
Die Probleme, die es in der Welt gibt, sind nicht mit der gleichen Denkweise zu lösen, die sie erzeugt hat.
Albert Einstein