Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Do 04.11.10 13:36 
Hi!

Ich möchte folgendes deklarieren:
ausblenden Delphi-Quelltext
1:
TAttributeName = String[50];					

Um Unicode-Gewappnet zu sein, müsste man doch dann aber eigentlich AnsiString[50] schreiben. Das geht aber nicht, den Längenbezeichner will Delphi 7 nur nach string sehen.
Sind ShortStrings (die das dann ja werden) vielleicht immer SingleByte (dann wäre aber die Nomenklatur seltsam)? Oder muss man da mit einer Versionsunterscheidung arbeiten, um das nur auf Compilern zu tun, die damit rechnen?

Hab leider kein neueres Delphi zur Verfügung, um das mal zu testen...

Grüße,
Sebastian

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 04.11.10 13:47 
Ein ShortString ist auch unter Delphi 2009 nur Ansi, einen Unicode-ShortString gibt es afaik nicht. An der Stelle gibt es also keine Probleme mit älteren/neueren Delphi-Versionen.

_________________
We are, we were and will not be.

Für diesen Beitrag haben gedankt: Martok
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Do 04.11.10 13:47 
Ein ShortString hat eine Länge von 0 bis 255 Zeichen. Obwohl sich seine Länge dynamisch ändern kann, beträgt die statische Speicherplatzzuweisung immer 256 Bytes

Für diesen Beitrag haben gedankt: Martok
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Do 04.11.10 13:51 
Ich liebe dieses Forum ;)

Danke euch beiden.

Ist also doch etwas ungünstig benannt der Typ, wenn doch mittlerweile String nicht mehr String ist. Naja. Mir kanns ja egal sein ;)

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 04.11.10 14:03 
Die Parameter von AnsiCompareString und ähnlichem sind in den neueren Delphi-Versionen ja auch UnicodeStrings, da geht also eh einiges durcheinander. ;-)

_________________
We are, we were and will not be.