Live data from Hacker News

Shit programmers write

shitprogrammerswrite.com

1–10 of 82 posts

Re: Shit programmers write

#6
> if (Session["startDate"] + "" == "")

This feels horribly familiar. I'm not sure to recognize the specific language used, but there must be cases where one would like to target empty of filled with non processable characters strings only, and let null and falsy values pass through. This kind of use would typically need a line of comment, but hey...

Re: Shit programmers write

#8
post #6

> if (Session["startDate"] + "" == "") This feels horribly familiar. I'm not sure to recognize the specific language used, but there must be cases where one would like to target empty of filled with non processable characters strings only, and let null and falsy values pass through. This kind of use would typically need a line of comment, but hey...

I'm guessing you don't realize that the plus operator has less precedence than the == operator.

That if is equivalent to if (startDate + true)

EDIT: I was wrong. I haven't slept.

Re: Shit programmers write

#10
post #6

> if (Session["startDate"] + "" == "") This feels horribly familiar. I'm not sure to recognize the specific language used, but there must be cases where one would like to target empty of filled with non processable characters strings only, and let null and falsy values pass through. This kind of use would typically need a line of comment, but hey...

I'm guessing you don't realize that the plus operator has less precedence than the == operator. That if is equivalent to if (startDate + true) EDIT: I was wrong. I haven't slept.

Sadly you are wrong. See an operator precedence list: http://bmanolov.free.fr/javaoperators.php
Post reply on HN