![]() |
Case: "Constant expression expected" mit Konstante
Hi alle,
habe hier mal wieder einen (meiner Meinung nach) ziemlich komischen Fehler. Der Compiler beschwert sich bei folgendem Code:
Delphi-Quellcode:
Irgendwelche Ideen? =)
const
DataBackend_Dat:ShortInt=0; begin case backend of DataBackend_Dat: Exit; // <-- Constant expression expected end; end; Gruß, Chris |
Re: Case: "Constant expression expected" mit Konst
lass mal
Zitat:
|
Re: Case: "Constant expression expected" mit Konst
Hi,
lass mal das ShortInt weg ;) [edit] Roter Kasten, ich vermisse dich... [/edit] |
Re: Case: "Constant expression expected" mit Konst
Hey, das funktioniert ja :lol: ... danke
Kann mir auch einer erklären, warum das ohne eine Typenangabe funktioniert und mit nicht? :?: Chris |
Re: Case: "Constant expression expected" mit Konst
Hai Alloc,
Case kommt mit ![]()
Delphi-Quellcode:
const
DataBackend_Dat = Shortint(0); |
Re: Case: "Constant expression expected" mit Konst
Typisierte "Konstanten" sind ja auch nicht konstant. Der Name und die Syntax ist einfach dumm gewählt. Eigentlich sind es lokale statische Variaben wie man sie von C-ish Sprachen kennt.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:36 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