what kind of bug?

M

Major_Small

would you include infinite loops, possibly infinite loops, unaccounted
for user input, infinite recursion, and that type of thing? if so
those are probably my biggest problems...

more specifically, I lose track of my loops and the scope of variables
while in those loops... for example:

for(int i=0;i<10;i++)
{
//code here
i--
//code here
}

in that example I may be using the LCV to try to increase (or
decrease) the amount of time the loop runs depending on how things go
inside the loop, but then I may miss something similar to above, where
it essentially creates an infinite loop...
 
V

Victor Bazarov

Major_Small said:
would you include infinite loops, possibly infinite loops, unaccounted
for user input, infinite recursion, and that type of thing? if so
those are probably my biggest problems...

more specifically, I lose track of my loops and the scope of variables
while in those loops... for example:

for(int i=0;i<10;i++)
{
//code here
i--
//code here
}

in that example I may be using the LCV to try to increase (or
decrease) the amount of time the loop runs depending on how things go
inside the loop, but then I may miss something similar to above, where
it essentially creates an infinite loop...

Are you responding to some other posting? I can't understand your
question, perhaps the context is missing. Next time try to stay in the
same posting thread instead of starting a new one.

If you're not responding to somebody's earlier posting, please be a bit
more clear on what you'd like to know. "What kind of bug?" is not a very
good subject line either.

If you're asking for a general discussion on what bugs are the toughest
to fix, for example, then I'd say, memory bugs. Especially buffer
overruns and using memory that has been freed. The trouble with those
is that the effect is intermittent and often shows up much later than
the cause of it.

V
 
D

dandelion

Major_Small said:
would you include infinite loops, possibly infinite loops, unaccounted
for user input, infinite recursion, and that type of thing? if so
those are probably my biggest problems...

more specifically, I lose track of my loops and the scope of variables
while in those loops... for example:

for(int i=0;i<10;i++)
{
//code here
i--
//code here
}

Don't do that. You are violating the llop invariant and things *will* get
messy very soon. The better solution is to rework your algorithm so you
don't need to modify variables associated with the invariant.

And that is *always* possible and *usually* ends up in much simpler
solutions.
 
M

Major_Small

Are you responding to some other posting? I can't understand your
question, perhaps the context is missing. Next time try to stay in the
same posting thread instead of starting a new one.

yeah, must have clicked a wrong link somewhere... meh...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,516
Latest member
ChrisHibbs

Latest Threads

Top