AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Achtung. Optimierung beim Compiler

Ein Thema von DelTurbo · begonnen am 8. Jun 2010 · letzter Beitrag vom 11. Jun 2010
 
Assertor

Registriert seit: 4. Feb 2006
Ort: Hamburg
1.296 Beiträge
 
Turbo C++
 
#16

AW: Achtung. Optimierung beim Compiler

  Alt 10. Jun 2010, 17:40
Hallo,

i ist im weiteren verlauf mein index auf ein anderes Array.
p80286 und himitsu haben absolut recht: Der Wert der Schleifenvariable ist nach der Schleife nicht garantiert, egal was Du machst. Um die Eingangsfrage zu beantworten: Ja, das Verhalten ist bekannt.

Die Herren Nick Hodges, Allen Bauer und Primoz Gabrijelcic schreiben es bei StackOverflow so:

Zitat:
That is correct. The variable is specifically documented to be undefined after the loop is complete. If you need a defined variable after the loop, use while or repeat – Nick Hodges Apr 9 at 22:45

Depending upon how the loop variable is used within the loop, the compiler may even eliminate it completely and simply use a pointer to iterate through the elements of an array, for example. – Allen Bauer Apr 10 at 0:02

... is undefined ... except if you terminate the loop with the 'break' statement. In that case, value is defined (the last value the loop counter had before the 'break' was executed). – gabr Apr 10 at 5:57
Der Sonderfall Break bzw. Exit wird von Gabrijelcic angerissen, in der Delphi Hilfe bzw. Daniels Delphi Referenz darauf wird das im Detail erörtert.

Gruß,
Assertor
Frederik
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:44 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