473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

infinite loop

how can we detect an infinite loop in visual basic 6.0 and so dat we can report an error whenever the program enters an infintie loop???
Jul 21 '07 #1
5 2115
hariharanmca
1,977 1GB
how can we detect an infinite loop in visual basic 6.0 and so dat we can report an error whenever the program enters an infintie loop???

You can use Recursion Function

Private Sub callRecursionFunction()
Statements...............
Statements...............
Statements...............
Statements...............
callRecursionFunction()
Statements...............
Statements...............
Statements...............
End Sub
Jul 21 '07 #2
You can use Recursion Function

Private Sub callRecursionFunction()
Statements...............
Statements...............
Statements...............
Statements...............
callRecursionFunction()
Statements...............
Statements...............
Statements...............
End Sub


sry but i cant understand wht u r trying to say. i am asking dat i am using many while loops and for loops in my program however if due sum condition or anything else the loop enters in an infintite loop do i have any way to detect it so dat i can report it to the user that the program has entered in an infintite loop???
Jul 21 '07 #3
Killer42
8,435 Expert 8TB
sry but i cant understand wht u r trying to say. i am asking dat i am using many while loops and for loops in my program however if due sum condition or anything else the loop enters in an infintite loop do i have any way to detect it so dat i can report it to the user that the program has entered in an infintite loop???
I don't think there is any easy way to catch this kind of thing. After all, a program often has to loop many times. At what point does "many" become "too many"? It would depend on the particular circumstances. In some cases, you may want it to loop "forever".

I suppose you could increment a counter each time around a loop, and clear it after exiting the loop. Keep watching it, and if it gets too large (you'd need to decide just how much is too much) then do your thing.

Probably the simplest way to implement that would be by calling some kind of standard "count these calls and tell me if I've done more than x" function.

By the way, as far as I can see what hariharanmca posted was not a way to detect an infinite loop, but an easy way to create one. Although this would not in fact keep going forever, as it would produce something like a "stack overflow" error after a while.
Jul 22 '07 #4
pureenhanoi
175 100+
how can we detect an infinite loop in visual basic 6.0 and so dat we can report an error whenever the program enters an infintie loop???
All programing language (not only VB) cannot recorgnize infinite loop by them-selft. Never try such a stupid job. Manage ur loop by ur-selft, if u're still a programer.
Jul 23 '07 #5
Killer42
8,435 Expert 8TB
All programing language (not only VB) cannot recorgnize infinite loop by them-selft. Never try such a stupid job. Manage ur loop by ur-selft, if u're still a programer.
That's what I said. :)

I just used more words. (Plus I was a bit more polite. Hint hint...)
Jul 23 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

43
by: Gremlin | last post by:
If you are not familiar with the halting problem, I will not go into it in detail but it states that it is impossible to write a program that can tell if a loop is infinite or not. This is a...
5
by: mailpitches | last post by:
Hello, Is there any way to kill a Javascript infinite loop in Safari without force-quitting the browser? MP
59
by: rami | last post by:
please everybody ,can anyone tell me how to do an infinite loop in C
44
by: James Watt | last post by:
can anyone tell me how to do an infinite loop in C/C++, please ? this is not a homework question .
48
by: James Watt | last post by:
can anyone tell me how to do an infinite loop in C/C++, please ? this is not a homework question .
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.