- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
Perhaps some of the people who defended the rewrite of the PHP date function would like to stand up for this one? After all, it's not broken, so we shouldn't need to fix it, right?
Admin
hubbard help us if this guy ever has to convert between characters and their codes
Admin
One of the most common conditions you have to test for in any high-level language is null-inequality. Are you saying that every single time you do this, you'll waste time trying to "refactor" code that's perfectly fine, or change it into an if-then-else with an empty if block?
Admin
I meant some shaky non-Java foreign place like from some C code. That could pass along any value.
Admin
Admin
I see the point, the code actually is too inaccurate. A much better function:
Admin
That's nothing, the coders who originally wrote the software I'm hacking have an insane love for code that looks like this:
to implement default values for variables. They also use many other variants including random combinations of isset() and !, sometimes, just to spice it up, they use different superglobals in the test and assignment. Spot the bugs!
They also have an incomprehensible love for code that looks like this:
The Goggles, they do nothing!!!
Admin
I'm not sure about C#, but in VB.NET, I once encountered some code which had used some interop to cast a byte that had been read from a file to bool. The result was a boolean value which was neither true nor false. So...
This took a while to figure out. In the debugger, if you hovered over the val, the tool-tip said it was True. But then if you stepped, it compare to True. It turned out that internally it was 255 or something.
Admin
I don't know about C#, but I've used a lot of other languages. A declaration of 'bool' means that the variable is supposed to have only two values, true and false. In some languages it could be null, which IMHO counts as a third value. In all languages variables are memory locations that can contain garbage, and the run-time stack will happily pass that garbage on to the subroutine. In theory a bool variable could be a single bit, but I've never seen a language that implements 'bool' that way. By trusting that the value is only true or false you are implicitly trusting the entire rest of the program.
Variables inside a function can be trusted; parameters should not be trusted and global variables should never be trusted.
Admin
Admin
I need to remeike my bathruem. Pls send me teh codez.
Admin
The compiler is there to optimize, not to work around absolute idiocy... ;oP
Admin
It's because you're writing bad code! This should be: if (flag==true) flag=false else flag=true;
if (amount1!=0) total=total+amount1 else total=total+amount1;
CAPTHA: ratis - must have something to do with "ratio"
Admin
BTW, could be better: if (flag==true) flag=true else flag=false;
at least you take a decision, like an adult
Admin
this.Suit.Color != Colors.Black
Admin
Admin
Yeah, that seems a bit half hearted. Better:
if((!shouldContinue) == false) { } else { goto skip; }
// blah....
skip:
Admin
I remember that one! among MANY, MANY others...
Admin
Most Christians and Muslims can take a joke too. And Jewish humour is legendary for its self-deprecating nature.
It's only saddos like you who go around saying people "should be punished" for not thinking the exact same way as you do.
Admin
Captcha: damnum "Damn. Um...."
Admin
I remember working out expressions I could use to set something according to the result of a comparison without using an if statement, because it would be too long to fit on one line as an if statement. Now that we have multi-line if statements and arbitrary line lengths this is only useful for obfuscation :)
Admin
Admin
The Clever Coder probably didn't get that job at Sunbelt Software; it's full of Scientologists, from Ekleberry on down.
Admin
It looks like another of those comments where they don't tell you quite enough for you to figure out what their problem is.
Admin
Admin
(Ahem. The whole barbershop now. "Spam, spam, it comes in a can, it's spam, it's spam, it's spam! Spaaaaaaammmmmmmm.")
Admin
DaveK
"Bollocks. Making fun of anyone is OK, we have this thing called freedom of speech.
Most Christians and Muslims can take a joke too. And Jewish humour is legendary for its self-deprecating nature.
It's only saddos like you who go around saying people "should be punished" for not thinking the exact same way as you do"
Not in the UK You can be arrested for "hate crinmes" for making jokes about Blacks Gays Muslims
but not apparently Christians or Jews in a country where a mother wih a disabled daughter can commit suicide after bieng terrorised by thugs and the police simply saying "close your curtains and pretend they arn't there" and yet a Christian couple can be arrested for Arguing with amuslim about religion .
Thr British "justice" system - the Ultimate WTF
Admin
This is not a copy-past so it might not be 100% the same (I think one of the cases was missing actually, lol). Anyway here's what I've found:
bool var1 = ...; bool var2;
if (true == true) { if (var1 == true) { var2 = true; } else if (var1 == false) { var2 = false; } } else if (false == false) { if (var1 == false) { var2 = false; } else if (var1 == true) { var2 = true; } }
And then when I tried to explain to the 2-4 YEARS EXPERIENCED .Net EXPERT that maybe... there... might... exist a way to slightly improve the way he handles booleans (say var2=var1), he asked me what I meant by "boolean"!?! And this guy has the same job as me and therefore probably earns the same thing at the end of the month...
Admin
Billant ... NOT
Admin
It's OK to make fun of scientology since its OK to make fun of every religion. Scientology is just a very easy victim since its (surprisingly) even MORE far fetched than the other big religions. And that is quite a feat and deserves ridicule!
Admin
Or "if (value ^ !(--(int*(&value))))"? And why the fuck is the function not static?
Admin
This reminds me of my favorite php function ever :)
Notice the single equal sign in the expression. A classic WTF :)
Admin
Often, when I see code like that, it is a result of someone doing refactoring and inlining a variable that is now constant.
Admin
Often, when I see code like that, it is a result of someone doing refactoring and inlining a variable that is now constant.
Admin
And somebody mentioned COBOL. No, it's no problem testing on booleans in COBOL (and COBOL-like languages) without saying 'if blabla = true'.
Admin
How do people who write code like that ever get a job as a programmer? People who write code like that should be fired immediately.
Did they get a serious job interview, or are they the CEO's nephew or something?
Suppose a carpenter comes to work on your house, and the carpenter doesn't know which side is up on a hammer. Would you allow him to do the work?
Admin
This is the wtf of course but...
... is even more horrible. Programmers are supposed to have studied maths; and especially boolean maths. It's like this guy didnt go to highschool.
Admin
Since when was bool(ean) a 'first-class' type in C??
Admin
No no no you've both got it all wrong. The most efficient way is clearly:
Admin
Admin
Admin
Still not good enough:
return FILE_NOT_FOUND }Admin
He's not. He didn't say that all Trolls are Scientologists!
Admin
Hey, this reminds me of a german phrase:
"Man darf ruhig dumm sein, man muss sich nur zu helfen wissen." "You are allowed to be stupid, you just have to find a way to help yourself."
P.S.: I hope I translated it correctly and it hasn't lost it's meaning.
Admin
"Personally i find this (value==false) to be aesthetically unappealing."
Personally I find snot-nose attitude like that soon to become aesthetically unappealing, right after my fist meets that nose.
No offense intended to you personally, I've just had my share of "boo hoo I want to spend time refactoring this code because it doesn't match my style" whining. If it works, don't touch it. Shut up.
There, I feel better now. Thanks for listening - or not.
Admin
Admin
Uhh, Scientology... is a joke.
Admin
I've never felt compelled to comment before but I have to agree.
What a complete dorko.
Admin
The joke is on them. Alex lost his pants a while ago at your mom's house. He just never bothered to go get them.
CAPTCHA: abigo -- Alex wishes.