Ich hab mal eine Frage an jene unter euch, welche mit der 64 bit Version unterwegs sind.
Wie gross ist eigentlich ein Cardinal auf 64 bit FPC?
Ich nehme an ein Pointer ist logischerweise 64 bit lang.
Wenn ich nun beispw. eine TList als Integer-List "missbrauche" d.h. ihre Pointer auf Cardinal oder Integer caste, bekomme ich da Probleme auf 64 bit oder sind die Integer und Cardinals auch einfach doppelt so lang und es ist im Prinzip egal? (Naja, ausser beim Streaming vielleicht)
64bit Pointer Typecasting
-
- Beiträge: 6079
- Registriert: Do 21. Sep 2006, 07:51
- OS, Lazarus, FPC: iWinux (L 1.x.xy FPC 2.y.z)
- CPU-Target: AVR,ARM,x86(-64)
- Wohnort: Dessau
- Kontaktdaten:
War ne wiele anner Küste
vllt hasts ja schon selbt gefunden wenn nicht:
The integer type maps to the smallint type in the default Free Pascal mode. It maps to either a
longint or int64 in either Delphi or ObjFPC mode. The cardinal type is currently always mapped to the longword type. The definition of the cardinal and integer types may change from one
architecture to another and from one compiler mode to another. They usually have the same size as
the underlying target architecture.
Free Pascal does automatic type conversion in expressions where different kinds of integer types are
used.
Integer either smallint, longint or int64 size 2,4 or 8
Cardinal either word, longword or qword size 2,4 or 8

The integer type maps to the smallint type in the default Free Pascal mode. It maps to either a
longint or int64 in either Delphi or ObjFPC mode. The cardinal type is currently always mapped to the longword type. The definition of the cardinal and integer types may change from one
architecture to another and from one compiler mode to another. They usually have the same size as
the underlying target architecture.
Free Pascal does automatic type conversion in expressions where different kinds of integer types are
used.
Integer either smallint, longint or int64 size 2,4 or 8
Cardinal either word, longword or qword size 2,4 or 8
W.m.k.A.h.e.m.F.h. -> http://www.gidf.de/
Ne frische Brise tut immer gutChristian hat geschrieben:War ne wiele anner Küste![]()

Ähm, ich interpretiere das mal so, dass es in Memory eigentlich klappen müsste.Christian hat geschrieben: Free Pascal does automatic type conversion in expressions where different kinds of integer
Probleme gibt's aber mit Sicherheit, wenn man irgendwelche Streams / Files mit Records welche Integers enthalten, oder z.B. SizeOf(Cardinal) auf die Platte schreibt und sie mit dem jew. anderen System zu laden versucht.
Sehe ich das richtig?
Ja gut, wenn man ein Smallint als Integer haben möchte. (Bisserl wenig).Christian hat geschrieben:im freepascal mode müsste es eigentlich in jedem fall klappen
Ich denke mal, wenn man beim Streaming einfach die präzisen Typen angibt (LongWord, Longint) und die zu erwartenden Daten jeweils in einen 32bit Typen passen, sollte es keine Probleme geben.
Der Compiler sollte die Konversion von LongInt Int64 eigentlich höchstens mit einer Warnung kommentieren, oder?