Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: disappearing segfault

by BrowserUk (Patriarch)
on Mar 11, 2009 at 03:59 UTC ( [id://749782]=note: print w/replies, xml ) Need Help??


in reply to disappearing segfault

If

- adding any print or warn statement to the file

"make the seg fault disappear", why not just add a harmless print statement?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: disappearing segfault
by davido (Cardinal) on Mar 11, 2009 at 06:26 UTC

    Because it's unreliable.

    Imagine someone shooting a BB gun blindfolded. He keeps hitting you in the butt and it's darn uncomfortable. So you move ten inches to the right. The BB's continue whizzing past you, "thwap, thwap, thwap..." Then the shooter scratches an itch and resumes shooting, but this time he hits you again. Or you lean to the side to pick something up... you get hit again. Or someone walks up to talk to you, and he gets hit. Just because you're not currently getting hit doesn't mean the BB's aren't hitting anything anymore. You're just not the one getting hit.

    Adding the print statement might stop you from getting bit by the bug, but it doesn't mean the bug isn't biting anymore. Some minor change elsewhere in the code could cause the stars to align again and you start getting bit again.

    Just a thought....


    Dave

      The point is that if the print statement truly fixed the problem, then it would be fixed. By definition.

      We both know that is unlikely. The reality is (most likely) that the addition of a print statement defers the symptom. And that realisation of itself is a useful one.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: disappearing segfault
by pobocks (Chaplain) on Mar 11, 2009 at 05:31 UTC

    Because building secret magic into your program is sloppy, and could easily bite him in the rear in time.

    Quick example: he adds the print statement. Someone inherits the code. They do some clean-up, kill the print statement. Boom, code segfaults for no apparent reason.

    It's just a bad idea to paper over potentially (and in this case, ACTUALLY) fatal, hard-to-trace errors instead of fixing them.

    for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";

      1. Why does it have to be "secret"? This would be a perfect example of when to legitimately use that mercilessly overused construct: a source code comment.
      2. Calm your indignation and try to think laterally. What other purposee might my suggestion serve?

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        1. Comment not previously mentioned, or, I would think, safely assumed. Magic is secret until proven otherwise ;-)

        2. In the future, please warn other monks that they're entering a socratic dialogue zone, wherein the reasonable assumption that people mean what they say isn't valid. Otherwise, you're basically baiting a rhetorical trap with flawed arguments, then declaiming as unsophisticated those who take them in the spirit that custom and logic suggests be the default reading.

        Maybe just a line reading: "Socrates sez," or an ASCII graphic of Admiral Ackbar.

        To make sure I'm being perfectly clear: I'm not (nor ever really was) indignant at you for either the first comment or this one; I just think that, intentionally or no, you're basically lecturing people for taking your statements in good faith, who have no reason to do otherwise.

        for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://749782]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-04-25 11:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found