1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

for (i=0; i < ONE TRILLION; i++) Large Number Of Iterations

Discussion in 'Win32' started by WaffenGeist, Oct 7, 2012.

  1. WaffenGeist

    WaffenGeist New Member

    Joined:
    Oct 7, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    When I enter the following, everything works:

    for (i=0; i < 1000; i++){}

    But suppose I want a large number, millions, billions etc.

    for (i=0; i < 1000000; i++){}

    Then my win32 program crashes, windows says "program not responding" and it can no longer be used.

    I need to survey ONE TRILLION bytes. How can I make a program repeat the same task over and over again for a very large number without the program crashing or not responding ?

    Thanks.
     
  2. hobbyist

    hobbyist New Member

    Joined:
    Jan 7, 2012
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    0
    I don't know what data type you're trying but you've got upper limits and overflow to worry about. If you really need a loop of that size, try unsigned long long or unsigned _int64 if your compiler supports it.

    Whatever you're up to, you'd probably be better off thinking of another approach to complete your objective.
     

Share This Page