![]() |
TMeinSet(Byte(1)) in Variable > ungültige Typumwandlung
Seit Jahren mache ich das so aber jetzt funktioniert es nicht mehr. Eine ungültige Typumwandlung. Aber wo?
Was ist daran denn falsch? Das sind so wenige Zeilen das gibts doch nicht. Weiß jemand weiter?
Delphi-Quellcode:
Komplettes Konsolenbeispiel
type
TGroups = (g1, g2, g3); TGroupSet = set of TGroups; var GroupSet: TGroupSet; begin GroupSet := TGroupSet(Byte(2));
Delphi-Quellcode:
program Project1;
{$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; type TGroups = (g1, g2, g3); TGroupSet = set of TGroups; var GroupSet: TGroupSet; begin GroupSet := TGroupSet(Byte(2)); end. |
AW: TMeinSet(Byte(1)) in Variable speichern funktioniert nicht, ungültige Typumwandlu
Spontan so:
Delphi-Quellcode:
var
GroupSet : TGroupSet; TempSet : Byte absolute GroupSet; begin TempSet := 2; end; |
AW: TMeinSet(Byte(1)) in Variable speichern funktioniert nicht, ungültige Typumwandlu
Das lässt sich beim Keyword absolute nicht kompilieren.^Die ungültiuge Typumwandlung bleibt dann aber auch.
Die Sache ist, dass der Code da oben mit anderen Variablennamen in einem anderen Projekt seit Jahren funktioniert! Wieso das da oben nicht? |
AW: TMeinSet(Byte(1)) in Variable speichern funktioniert nicht, ungültige Typumwandlu
Seltsam. Ich hatte es compiliert und debugged bevor ich es geposted habe.
|
AW: TMeinSet(Byte(1)) in Variable speichern funktioniert nicht, ungültige Typumwandlu
Hier eine Konsolenanwendung die nur das beinhaltet. Da kommt die ungültige Typumwandlung auch
Delphi-Quellcode:
Ich verstehe langsam die Welt nicht mehr. In anderen Projekten funktioniert das seit Jahren. Entweder ist Delphi kaputt bei mir oder ich habe einen äußerst schrecklichen Copy paste Fehler drin.
program Project1;
{$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; type TGroups = (g1, g2, g3); TGroupSet = set of TGroups; var GroupSet: TGroupSet; begin GroupSet := TGroupSet(Byte(2)); end. |
AW: TMeinSet(Byte(1)) in Variable speichern funktioniert nicht, ungültige Typumwandlu
Zeig doch mal den compilierfähigen Code aus einem anderen Projekt.
|
AW: TMeinSet(Byte(1)) in Variable speichern funktioniert nicht, ungültige Typumwandlu
Das kann ich nicht, da es sich hier um Firmencode handelt. Der ist 1 zu 1 gleich. Nur die Variablennamen sind anders (Wochentage).
|
AW: TMeinSet(Byte(1)) in Variable speichern funktioniert nicht, ungültige Typumwandlu
Dann bau doch ein Beispiel das man compilieren kann, und welches nur aus Deklaration und Zuweisung besteht. Damit verletzt Du dann auch keine Firmengeheimnisse.
|
AW: TMeinSet(Byte(1)) in Variable speichern funktioniert nicht, ungültige Typumwandlu
Zitat:
Hier ist der Code aus dem funktionierenden Projekt. Eins zu eins rauskopiert. Andere Variablennamen aber das ist egal denn die Originalnamen lassen sich auch nicht kompilieren.
Delphi-Quellcode:
Das iwr auf das absolute Minimum reduziert und es funktioniert nicht. Irgendwo ist da doch ein Loch im Köse zuviel!
program Project1;
{$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; type TDOF = (d1, d2, d3, d4, d5, d6, d7); TDOFSet = set of TDOF; type TGroups = (g1, g2, g3); TGroupSet = set of TGroups; var Days: TDOFSet; GroupSet: TGroupSet; begin Days := TDOFSet(Byte(2)); GroupSet := TGroupSet(Byte(2)); end. |
AW: TMeinSet(Byte(1)) in Variable speichern funktioniert nicht, ungültige Typumwandlu
Compilersettings
MinEnumSize steht da wahrscheinlich falsch Word oder Double Word und nicht auf Byte im deutschen Delphi "Mindestgrösse für Enum" |
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:04 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 by Thomas Breitkreuz