Autor Beitrag
Niko S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Fr 16.01.09 14:48 
Ich versuche einer Procedure eine array zu übergeben nur so damit die procedure da was reinschreiben kann .
Aber irgendwie funktioniert das nicht sobald ich in der procedure der array einen Wert zuweisen will bekomm ich nen
Stack überlauf fehler...

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
type
  TMyItem = array[0..999999of array[0..21of String;
...
var
  Form1: TForm1;
  MyItems: TMyItem;

...

procedure TForm1.LoadDB(db: TStringList; MyItem2: TMyItem);
var
  i,q,id: Integer;
  str: String;
begin
  for i := 0 to db.Count - 1 do
  begin
    if (Pos('//',db.Strings[i]) = 0AND (db.Strings[i] <> ''then
    begin
      str := db.Strings[i];
      id := StrToInt(Copy(str,0,Pos(',',str)-1));
      Myitem2[id,1] := IntToStr(id);
      for q := 1 to 18 do
      begin
        str := Copy(str,Pos(',',str)+1,length(str));
        Myitem2[id,q] := Copy(str,0,Pos(',',str)-1);
      end;
    end;
  end;
end;

...



Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Sa 17.01.2009 um 12:16
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 16.01.09 14:52 
Übergib das Ding als var oder const Parameter, dann wird nur ein Pointer auf das eigentliche Array übergeben.

_________________
PROGRAMMER: A device for converting coffee into software.


Zuletzt bearbeitet von Xentar am Sa 17.01.09 17:00, insgesamt 1-mal bearbeitet
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Sa 17.01.09 13:15 
Moin!

user profile iconNiko S. hat folgendes geschrieben Zum zitierten Posting springen:
Ich versuche einer Procedure eine array zu übergeben nur so damit die procedure da was reinschreiben kann .
user profile iconXentar hat folgendes geschrieben Zum zitierten Posting springen:
Übergib das Ding als var oder const Parameter,
Dann wollen wir im Interesse eines vernünftigen Programmierstils doch mal die von dir genannte Alternative unter den Tisch fallen lassen... 8) ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Sa 17.01.09 13:31 
user profile iconNiko S. hat folgendes geschrieben Zum zitierten Posting springen:
array[0..999999] of array[0..21]
Ohne jetzt den Rest gelesen zu haben: Wahrscheinlich der falsche Ansatz ;) Schonmal was von Suche in der Entwickler-Ecke DYNAMISCHEN ARRAYS gehört?

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Sa 17.01.09 13:42 
999999 * 21 Byte = 20999979 Bytes = 201922 KB = 197 MB

hmmm, das Programm ist nicht grd speicherschonend. Ein echt dicker Brocken...
*Grins*
Msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Sa 17.01.09 13:45 
Ja das ist mir durchaus bewusst ... das wird auch noch gefixt =) das hat ja soweit alles hingehauen nur wie man aus dem anderen topic entnehmen kann die ganze sache in eine DLL zu bringen nicht wirklich!
Es wäre ja auch nicht schlimm aber ich weiß das ich die funktion noch in mindestens einem anderen Programm nutzen werde und da haette es sich halt angeboten das ganze in eine dll zu verpacken!
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Sa 17.01.09 14:18 
Hi :)

Könntest du evtl. einen Edit machen und das genannte Topic im Erstpost verlinken? Ansonsten ist das jetzt natürlich eine andere Frage und gehört wahrscheinlich in das Topic ;)

Wozu brauchst du denn so große, statische Arrays(Im Arbeitsspeicher!) täte(n) es nicht eine oder mehrere Dateien auf der Festplatte, oder muss auf das gesammte Array ständig zugegriffen werden?

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)


Zuletzt bearbeitet von Hidden am Sa 17.01.09 17:25, insgesamt 2-mal bearbeitet
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Sa 17.01.09 14:25 
Moin!

Die Frage nach dem Sinn eines großen Arrays im RAM wollen wir aber doch nicht mehr hier diskutieren, OK? ;) Dafür böte sich ein frisches neues Topic doch viel besser an... :)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Sa 17.01.09 14:29 
ich habe mich wie ich grad sehe um eine 9 vertippt x(
Davon mal abgesehen ist das erstmal nur sporadisch um das ganze zu testen wie gesagt das was ich hier in dem topic frage ist nun geklärt was mich noch bedrückt ist in diesem topic:
www.delphi-forum.de/viewtopic.php?t=89441

Thx ;)
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 17.01.09 16:59 
user profile iconNarses hat folgendes geschrieben Zum zitierten Posting springen:
Moin!

user profile iconNiko S. hat folgendes geschrieben Zum zitierten Posting springen:
Ich versuche einer Procedure eine array zu übergeben nur so damit die procedure da was reinschreiben kann .
user profile iconXentar hat folgendes geschrieben Zum zitierten Posting springen:
Übergib das Ding als var oder const Parameter,
Dann wollen wir im Interesse eines vernünftigen Programmierstils doch mal die von dir genannte Alternative unter den Tisch fallen lassen... 8) ;)

cu
Narses

Hm ja, besser ist das ;)
Hatte nur gelesen, dass er nen Stack Überlauf Fehler bekommt - und den kann man ja mit beiden Methoden lösen. Wenn die Werte dann noch verändert werden sollen, bleibt nur noch var über

_________________
PROGRAMMER: A device for converting coffee into software.