Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi wozu LongInt? (https://www.delphipraxis.net/13125-wozu-longint.html)

Pseudemys Nelsoni 11. Dez 2003 13:21


wozu LongInt?
 
hoi,

in meinem buch steht das Integer und LongInt ab Delphi2 sich in der länge nicht unterscheiden, wozu gibt es dann noch longint?

Tyrael Y. 11. Dez 2003 13:23

Re: wozu LongInt?
 
Auszug aus Delphi5 Hilfe:

Zitat:

Type Range Format
Integer –2147483648..2147483647 signed 32-bit
Cardinal 0..4294967295 unsigned 32-bit
Fundamental integer types include Shortint, Smallint, Longint, Int64, Byte, Word, and Longword.

Type Range Format
Shortint –128..127 signed 8-bit
Smallint –32768..32767 signed 16-bit
Longint –2147483648..2147483647 signed 32-bit
Int64 –2^63..2^63–1 signed 64-bit
Byte 0..255 unsigned 8-bit
Word 0..65535 unsigned 16-bit
Longword 0..4294967295 unsigned 32-bit

X-Dragon 11. Dez 2003 13:26

Re: wozu LongInt?
 
Zitat:

Zitat von Pseudemys Nelsoni
hoi,

in meinem buch steht das Integer und LongInt ab Delphi2 sich in der länge nicht unterscheiden, wozu gibt es dann noch longint?

Aus "Kompatibilitätsgründen"? :)

Zitat:

An integer type represents a subset of the whole numbers. The generic integer types are Integer and Cardinal; use these whenever possible, since they result in the best performance for the underlying CPU and operating system. The table below gives their ranges and storage formats for the current 32-bit Object Pascal compiler.
...

Quelle: Delphi-Hilfe - Integer types

Pseudemys Nelsoni 11. Dez 2003 13:26

Re: wozu LongInt?
 
hm, irgendwie seh ich da keine antwort auf meine frage

achso, longint ist fundamental(warum auch immer)

thx @all^^

Tyrael Y. 11. Dez 2003 13:29

Re: wozu LongInt?
 
Ja aus Kompatibilitätsgründen, sonst sind sie gleich definiert.

Hast es ja doch gelesen mit dem "fundamental", ;)

Sanchez 11. Dez 2003 13:30

Re: wozu LongInt?
 
Ist es nicht so, dass int auf verschiedenen Plattformen unterschiedlich groß ist?
Daran kann ich mich dunkel aus der Schulzeit erinnern.

X-Dragon 11. Dez 2003 13:32

Re: wozu LongInt?
 
Zitat:

Zitat von Pseudemys Nelsoni
hm, irgendwie seh ich da keine antwort auf meine frage
...

Auch wenn ich hinter meine Antwort ein "?" gesetzt habe, so ist das meiner Meinung nach der einzige sinnvolle Grund. Denn Datentypen wirft man im allgmeinen nicht einfach so bei einer Programmiersprache raus, da dann alle "älteren" Programm entsprechend umgeschrieben werden müßten.

Bernhard Geyer 11. Dez 2003 13:33

Re: wozu LongInt?
 
Zitat:

Ist es nicht so, dass int auf verschiedenen Plattformen unterschiedlich groß ist?
Daran kann ich mich dunkel aus der Schulzeit erinnern.
Das ist im Standard von C/C++ so definiert (oder halt nicht definiert wie groß int ist).

Für D1 ist int = 16 Bit, Ab D2 ist int = 32 Bit. Und das es int64 gibt wird Borland hoffentlich nicht irgendwann int = 64 Bit definieren.

Vjay 11. Dez 2003 13:39

Re: wozu LongInt?
 
Ich denke schon, wenn du sagst du willst nen "integer" bekommste den Default-Speicherplatz. Z.b. 32 Bit OS 32bit int. Bald wird dieser zu 64 Bit und die Leute werden Posten.
"Wozu gibt es int64 und integer, die sind doch beide gleich gross?" :)

Also wenn ihr definitiv nen int32 braucht benutzt besser longint, sonst wirds in DelphiX nichts mehr mit 4Byte.

MFG
V.


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:38 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