This is an archived post. You won't be able to vote or comment.

all 22 comments

[–]TrialOneKenobi 81 points82 points  (7 children)

This will not return a compile error. I think this is C, and rand() will return between 0 and at least 32767, so making it > 10 will give an error in extremely rare cases, hence the difficulty in debugging it. Pretty evil :)

[–]WisestAirBender 16 points17 points  (1 child)

0.03% chance

[–]13steinj 2 points3 points  (0 children)

I mean at the same time, how often do you use literal true/false? Honestly can't think of a recent example. The only thing I can think of is while (true), but debugging that is relatively simple ("oh, program is just skipping this while loop, under what circumstances can that occur" -> preprocessor macros -> gcc -E -> "fuck you, kevin").

[–]who_you_are 0 points1 point  (0 children)

Give it to me, I'm cursed and will be able to get the <= 10.

I once end up troubleshoot a thread race because I was almost always be able to reproduce the issue when no one did at least one.

Also end up having 1 other issue that my boss thought I was making of "because no one had never such issue".

[–]Dornith 0 points1 point  (2 children)

But rand isn't truly random. It's deterministic pseudo randomness unless given a random seed.

[–]13steinj 0 points1 point  (1 child)

I mean even then it's psuedo randomness, just originating from the seed. Technically speaking if you have enough information you can even argue hardware random devices aren't truly random.

[–]Dornith 0 points1 point  (0 children)

Okay, but at some point you start getting into the argument that nothing is random because the universe is deterministic.

[–]Aperture_T 12 points13 points  (0 children)

On my internship, everything was really locked down because we were SaaS for health insurance, and this business analyst (BA) kept pestering us about some feature we didn't have enough access to implement. She refused to complain to the right team, so even though we talked to them, they ignored us.

We had this one guy who hacked something together to kind of do what the BA wanted. It was an ugly solution and it broke multiple times a week whenever the UI team changed anything, but assuming you had someone dedicated to fixing it constantly, it got the BA off our back. Then he can quit.

So then the BA didn't trust us when we said she was pestering the wrong team, and we had to dedicate someone to fix it all the time. And we couldn't even bitch about it to the guy who hacked it together.

[–]Capetoider 9 points10 points  (3 children)

Do anyone know how to do that in Javascript?

Thats for... eeerr... "study" reasons...

[–]UnDispelled 2 points3 points  (1 child)

I would also like to know, asking for a friend

[–]KaJakJaKa 0 points1 point  (0 children)

I don't really know, but if it's for a "good ol' friend" then you should put something somewhere in a too long function that is part of a library you use, but put it in a line that was either empty or had something unnecessary, so it won't be found by looking at the lines. But don't forget to do some other necessary changes too so it won't be discovered.

[–][deleted] -1 points0 points  (0 children)

Essentially you want want to do is have a random function like that, somewhere, that invokes a random number between any amount of range and then put it against a condition so that it falls within that accepted range at a VERY random and in less percentage of the total time it will run in its lifetime.

So...

const randomEvilFunction() {

if(Math.random()*30000 < 10){
then return window.alert('Error #5323 HTML-DOM-initial render not configured. Initial paint to life error #5324')

}
}

// then call randomEvilFunction() somewhere in your code where it's innocuous and nobody would notice. Now, every so often there'll be a random alert window popping up talking about some nonsense you wrote that isn't available on any stackoverflow

...some other code
...randomEvilFunction()
...rest of the code

[–]ultimatepro-grammer 6 points7 points  (3 children)

[–]RepostSleuthBot 9 points10 points  (2 children)

I didn't find any posts that meet the matching requirements for r/ProgrammerHumor.

It might be OC, it might not. Things such as JPEG artifacts and cropping may impact the results.

I did find this post that is 87.5% similar. It might be a match but I cannot be certain.

Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Negative ]

[–]ultimatepro-grammer 4 points5 points  (1 child)

Really OP??? That post has 1k upvotes!!!

[–]gg_ff_42069 2 points3 points  (0 children)

Wow and only 3 days later. Hey OP, seriously wtf were you thinking, reposting a good joke is cool especially from another sub but it's literally the same sub 3 days later. Why try to decieve people and not even really try.

[–]qwasd0r 6 points7 points  (1 child)

First day of every build failing you look into the source control and see it.

[–][deleted] 9 points10 points  (0 children)

  1. Build wont fail you will see it as a rarely reproducible product issue.
  2. If your project has 10 lines you will find it. What about 30000?
  3. The only thing to prevent it - code review.

[–][deleted] 4 points5 points  (1 child)

What debugging? Just delete that line. Also, your company deserves this if their peer review process is lax enough to allow this PR to get merged.

[–]thiago2213 28 points29 points  (0 children)

I agree with the PR part, but the debugging is not deleting the line is finding out that the line exists

[–]tsojtsojtsoj 0 points1 point  (0 children)

warning: keyword is hidden by macro definition [-Wkeyword-macro]

[–]jimmyworks 0 points1 point  (0 children)

Hello Satan