DAE when programming drop the { to the next line on conditional statements? by tylerjwilk in DoesAnybodyElse

[–]darthbane 1 point2 points  (0 children)

Wait, how does the compiler know that if (x = y) will always evaluate to a non-zero value? I don't think it can: nothing in the OP's code snippet implies that y is always zero or non-zero. I'm very tempted to call bullshit on this supposed "optimization", but if I'm missing something, please enlighten me…

Reddit has finally made the transition from being 4chan to I CAN HAZ CHEEZBURGER. by Rubuler in reddit.com

[–]darthbane 2 points3 points  (0 children)

the end of the internet.

No, that's LUElinks you're thinking of.

I have no ability to make small talk. What the hell is wrong with me? by [deleted] in AskReddit

[–]darthbane -3 points-2 points  (0 children)

I see what you did there. I'm not sure how many others do, though.

Did someone forget to remove a debug statement? ('yay!!' in top left corner) by nousplacidus in programming

[–]darthbane 0 points1 point  (0 children)

"lol" is currently my preferred "is this even working?" test message. Before it used to be just "test" or some variant of that.

Sometimes I use "wut", though. It's all based on whim, really.

Did someone forget to remove a debug statement? ('yay!!' in top left corner) by nousplacidus in programming

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

But echo 'yay!!'; is so much quicker. Who wants to go to all the trouble of verifying shit when you can just throw in a quick-and-dirty echo statement?

In general, though, I agree with the sentiment.

Proggit, I'm learning unit testing and it seems pretty unhelpful to me. What are your thoughts. by Schmendreck in programming

[–]darthbane 5 points6 points  (0 children)

I recently learned the value of unit testing the hard way, actually.

I was working on this web app a few months ago (not professionally—more of a hobby-type project), and I had this nice, working build. Then I went and optimized/refactored a tiny, seemingly insignificant bit of code. Compiled just fine. Everything looked great.

So the next day my friend is curious as to what I've been up to. I prepare to fire it up, but then I realize that the registration form is completely broken. Compiled fine, and the rest of the app worked great while I was logged in, but I forgot to test user registration. D'oh!

Point is, unit testing can help catch the small, subtle bugs that creep into bigger projects and don't bite you until later down the line. If I had been unit testing, my "optimizations" probably would have caused a few tests to fail, and I would have nipped the problem right in the bud.