Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   record - Speicherzuweisung klappt nicht (https://www.delphipraxis.net/213934-record-speicherzuweisung-klappt-nicht.html)

paule32.jk 21. Okt 2023 11:52

record - Speicherzuweisung klappt nicht
 
Hallo,
leider klappt die Speicherverwaltung eines RECORDs mit den folgenden Code nicht:
Delphi-Quellcode:
TOpCode = (lit,opr,lod,sto,cal,int,jmp,jpc,wri);
Instruction = record
  f: TOpCode; // command
  l: Byte;   // level
  a: Integer; // address
end;

var
instr: Instruction;
SetLength(instr,sizeof(Instruction));

Kas Ob. 21. Okt 2023 12:09

AW: record - Speicherzuweisung klappt nicht
 
Try this
Code:
var
  instrs : array of Instruction;
  NumberOfInstruction : Integer;

begin
  NumberOfInstruction := 5;
  SetLength(instrs, NumberOfInstruction);

Redeemer 21. Okt 2023 15:15

AW: record - Speicherzuweisung klappt nicht
 
Was soll denn da passieren? Das ist ein Record mit fester Größe (alle Records haben eine feste Größe), warum willst du da die Größe ändern?

Kas Ob. 21. Okt 2023 16:58

AW: record - Speicherzuweisung klappt nicht
 
Liste der Anhänge anzeigen (Anzahl: 2)
Guys, have a look at this :shock:

The translations is doing some nasty stuff.
Anhang 56362Anhang 56363

himitsu 22. Okt 2023 10:31

AW: record - Speicherzuweisung klappt nicht
 
Warum immer wieder neue Threads,
https://www.delphipraxis.net/213934-...ppt-nicht.html
https://www.delphipraxis.net/213935-...-new-post.html
https://www.delphipraxis.net/213937-...-new-post.html
anstatt das eigentliche Problem endlich zu lösen?
https://www.delphipraxis.net/213929-...ml#post1528456


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:48 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz