home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,833 of 2,978   
   Scott Moore to N. Foldager   
   Re: For-to variable goes backwards   
   14 Jul 05 14:16:43   
   
   From: samiamsansspam@Sun.COM   
      
   N. Foldager wrote:   
   >   
   > When I step through a for- to loop like:   
   >   
   > for  I =:  1  to  10  do   
   >   
   > the variable, I,  actually starts with 10 and counts down instead of   
   > up. This is a  known; it should be due to some optimization.   
   >   
   > But why is this more optimal in the generated code?   
   >   
   > Is there a way to switch this optimization off as long as I am   
   > debugging my program?   
   >   
   > It is *most* disturbing during debugging.   
   >   
   > Best regards,   
   >   
   > Niels Foldager   
   >   
      
   You didn't use i in the loop. The compiler is perfectly correct   
   in rearranging the way the counter works.   
      
   What it did was rearrange the loop so i is decremented to zero,   
   which makes the end check *free*, because the dec instruction will   
   set the zero flag.   
      
   If you want transparent code, turn your optimizations off.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca