[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

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

Erik Terpstra

2/18/2005 11:02:00 AM

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.
2 Answers

Robert Klemme

2/18/2005 11:04:00 AM

0


"Erik Terpstra" <erik@terpnet.nl> schrieb im Newsbeitrag
news:4215cb12$0$28982$e4fe514c@news.xs4all.nl...
> 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.... ) and probably your input file.

Kind regards

robert

Florian Gross

2/18/2005 12:51:00 PM

0

Erik Terpstra wrote:

> 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?