tariq6000
asked on
for loop not iterate more than 800000
hi,
i wrote a simple FOR LOOP program in cocoa-objective c (MAC os- compiler XCode). but it not working properly. the loop iterating only upto some value near to 714300( value change each time running). program is given below.
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
unsigned long long i=1;
for(i=1;i!=0;++i)
printf("%llu\n",i);
printf("finished");
//printf("\n%llu",i++);
//printf("\r%llu",i);
return NSApplicationMain(argc, (const char **) argv);
}
if first printf statement is replaced as printf("%llu-",i); it iterate beyond 1000000 but it run very slowly( take nearly one hour to reach 1000000). what is the problem with this program.
i wrote a simple FOR LOOP program in cocoa-objective c (MAC os- compiler XCode). but it not working properly. the loop iterating only upto some value near to 714300( value change each time running). program is given below.
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
unsigned long long i=1;
for(i=1;i!=0;++i)
printf("%llu\n",i);
printf("finished");
//printf("\n%llu",i++);
//printf("\r%llu",i);
return NSApplicationMain(argc, (const char **) argv);
}
if first printf statement is replaced as printf("%llu-",i); it iterate beyond 1000000 but it run very slowly( take nearly one hour to reach 1000000). what is the problem with this program.
ASKER
now i am using mac mini -Tiger 10.4
compiler is Xcode
compiler is Xcode
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
On my system, ULONG_LONG_MAX is 4,294,967,295
Therefore I'd expect my system to get rather 'warm' running your app here.