What to do when adding a comment makes your program behave differently???

E

Erik Terpstra

Hi,

I a have built a program (433 lines) which takes a file as an argument,
processes it and provides its result to STDOUT.

When I add a comment (just a '#' character will do) below the last line
of the program, it works fine.

When I remove the comment it behaves differently, the result is
incorrect but Ruby does not give an error or a warning whatsoever. (I
don't have any rescue statements in my program).

What can I do right now? (Except for switching to another language ;-)

TIA,

Erik.

P.S.: I am willing to send my code, but I expect it will work fine
elsewhere because it is probably a GC/timing related Ruby bug.
 
R

Robert Klemme

Erik Terpstra said:
Hi,

I a have built a program (433 lines) which takes a file as an argument,
processes it and provides its result to STDOUT.

When I add a comment (just a '#' character will do) below the last line
of the program, it works fine.

When I remove the comment it behaves differently, the result is
incorrect but Ruby does not give an error or a warning whatsoever. (I
don't have any rescue statements in my program).

What can I do right now? (Except for switching to another language ;-)

TIA,

Erik.

P.S.: I am willing to send my code, but I expect it will work fine
elsewhere because it is probably a GC/timing related Ruby bug.

With that little information nobody really can help you with this. Please
post code (if it's larger, you might want to use a public pasting board
such as http://rafb.net/paste/ ) and probably your input file.

Kind regards

robert
 
F

Florian Gross

Erik said:
When I add a comment (just a '#' character will do) below the last line
of the program, it works fine.

When I remove the comment it behaves differently, the result is
incorrect but Ruby does not give an error or a warning whatsoever. (I
don't have any rescue statements in my program).

Things like this might be caused when you're relying on the order of
something unordered. Hash#keys, #values, the output of methods and other
things have undefined order. Are you sure it is not something like this?
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top