Re: Calculations in a loop



Dann Corbit wrote:
In article <c90e4442-455f-4ca9-b9fb-e20c04c09b40
@z15g2000prh.googlegroups.com>, ameliajane42@xxxxxxxxx says...
On May 19, 1:01 pm, Patricia Shanahan <p...@xxxxxxx> wrote:
stan wrote:

...

I agree with the others as to possible causes, but I might add
that this may be a perfect time to learn to step through code in a
debugger. You might discover the problem with your code and you will
certainly learn a skill which can be very handy. It won't be time
wasted. Debuggers are not a silver bullet, they can't solve every
problem all the time. But when you fine yourself stumped you can never
have too many tools available.
Good advice. The OP needs to be particularly careful to debug a version
that actually fails, not a similar program that works.

Patricia
It was a real dumb problem. The variable in the loop was incremented
elsewhere making the loop to end prematurely. My bad...

This is why it is a good idea to post the actual code that reproduces the problem.


Often the original code is too big and complicated to post. Producing a
simplified example is very useful. However, it is essential to check
that the simplified code reproduces the original problem. If not, the
implication is that the problem involves something that was removed
during simplification, an important debug clue.

Patricia
.



Relevant Pages

  • Re: When is "volatile" used instead of "lock" ?
    ... This is because you run this code in a "managed debugger", the JIT produces different code from what is produced when no managed bedugger is attached! ... This sequence is repeated until the loop counter reaches the count value. ... I was expecting the JIT to do much better optimizations (looping x times ... with local variables. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Sorry if it is not for this forum
    ... >> loop uses that variable as an array index. ... A code generator / debugger message something like ... Verify reported buggy behavior. ... with the same level of optimization as the shipped code. ...
    (comp.lang.c)
  • Re: Assigning User input to an array
    ... have I still to work on the output for loop. ... IDE I use, has a good debugger. ... language for that matter), I think a debugger for that language is a good ...
    (comp.lang.java.programmer)
  • 68k chip, Diab Compiler and odd behavior
    ... The first 16 times through the loop ... the debugger, line 12 is executed and the debugger skips 13 and 14, ... ulword tmpfaultvalue; ... ulword shift; ...
    (comp.arch.embedded)
  • Re: Question: How usable is Linux Visual-Eiffel? One more question.
    ... > is very common... ... or some I/O related (usually H/W) does ... Your example of a "thinko" related to loop termination is ... with a debugger. ...
    (comp.lang.eiffel)