Hi,
In my app running on snow leopard, in a particular situation I'm getting an 
undesired behavior.
Debugging a "for loop" shows a still in scope variable being optimized away.

code: (problem occurs after the loop has been iterated thousands (may be more) 
of time.

        for loop statement here()
        {
        NSDate *currentDate = [NSDate date];// ok value here
        NSTimeInterval interval = [currentDate 
timeIntervalSinceDate:startDate];// ok value here
        NSTimeInterval etaDouble = interval  * ((totalBlocks - blockCount) / 
blockCount);       // * debugger doesn't list this variable, mouse shows a pop 
up saying "variable optimized away by compiler"
        int eta = (int)etaDouble;       // value is 0 here instead of something
        int seconds = eta % 60;         // value is 0 here instead of something
        int minutes = (eta / 60) % 60;  // value is 0 here instead of something
        int hours = ((eta / 60) / 60) % 24;     // value is 0 here instead of 
something
        int days = ((eta / 60) / 60) / 24;      // value is 0 here instead of 
something


        }

Why the certain variables are not listed in debugger window (only in GC-only 
projects)?
Why is etaDouble is being optimized away?
Any suggestions?


Wishes,
Nick

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to