Autor Beitrag
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 28.04.03 14:16 
Seit Delphi 5 erzeugt Inc und i = i+1 den gleichen Assembler Coder.

Und gibt man bei Inc keinen zweiten Paramter an, wird automatisch um eins erhöht.
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: Mo 28.04.03 14:23 
Titel: Ich glaube mal, du hast die Hilfe falsch verstanden ...
Frisch aus der Hilfe D7 ...
Zitat:
X increments by 1, or by N if N is specified; that is, Inc(X) corresponds to the statement X := X + 1, and Inc(X, N) corresponds to the statement X := X + N. However, Inc generates optimized code and is especially useful in tight loops.

Da steht nix anderes, daß inc(X) und X:=X+1 gleichwertig sind, ABER der Code von Inc optimiert wird.

Ich kann mir auch ehrlich nicht vorstellen, daß D7 eine Optimierung, die schon TurboPascal konnte, fallen gelassen hat. :P

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.