Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a theoretical limit on loop iterations?

Status
Not open for further replies.

RamonetB

Technical User
Oct 20, 2003
4
US
Is there a limit on the number of times a loops is allowed to execute? Theoretically speaking I mean, not one defined by the loops boundaries.

I have a simple loop that sets each value in an array to 0. however, when the iterations get very large (2.5e+16 etc) strange things are happening. It stops iterate, the ending boundary condition changes on its own and I get a program access violation.

Is this a compiler limitation or something else?


Thanks,

kirk
 
The maximum integer*4 that you can use index the array is 2**31-1 (~= 2.0E+9). If you increment it past this value, it will go to -2**32. If your compiler allows you to index using integer*8, the maximum is 2**63-1 (~= 9.2E+18)

CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top