- 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
Fair point, but....
So gcc (or at least the version I happened to try this with) doesn't seem to mind about the lack of stdlib.h (think that'll cover srand(), rand() and time()) but isn't completely happy about the lack of stdio.h (for printf())
And thanks Aspirant! All the comments about my macro have made me smile :-)
Admin
corporate passive agressive tactics huh? i'd go for a laxant in his coffee...
Admin
Who hasn't done something like this before?
Admin
Yeah, but you can never assume that in C++, because you don't have runtime encapsulation. Take a look at this:
Hey, look at that! I just modified the object's "internal state" without using its "public interface"! That's because in C++, there's no such thing as "internal state", there's just a chunk of memory with data in it, and "private" might as well be a comment. If you start debugging by assuming that private members can only be changed by the class's functions, you'll be in trouble quickly.
Admin
What's the big deal? Reflection allows you to modify private/protected fields and invoke private/protected methods in .Net and Java without resorting to pointer hacks. In my unqualified opinion, access modifiers are tools for use of classes under normal conditions, not some kind of security measure.
Admin
Ahem.
That's a different "wtf (unregistered)" than the one you're used to reading. Just so's you know. (wouldn't want that "teh" associated with any writing I do, even anonymously, nor the incorrect use of the possessive "your" or the use of "reference" as a verb - get your fingernails off that chalkboard, you! - or really anything else in this post)
Admin
From Bash.org.ru?
Admin
I mostly took exception to the idea that you can rely on the internal state of an object to never be corrupted by external factors when debugging C++. All sorts of things can shit on the internal state of an object from outside and create hard-to-track-down bugs; if you've got a big C++ codebase you need to be ready for that when it inevitably happens.
If you
, you at least know that you're explicitly asking for trouble; pointer tricks can be less benign.Admin
I can't disagree with that. I've done much worse things using unitialized pointers. It can be quite confusing when you see dissembled code change before your eyes when single stepping through C++ code.
Anyway, given the context of the entire thread, I believe I should have drank more coffee and taken less cold medicine before posting.
Admin
"Hanlon's Razor" is not a true "razor" ("Messer" in the native German) but the name was inspired by Occam's Razor. It states that one should "never attribute to malice that which is adequately explained by stupidity".
Seriously, how do you confuse Occam's Razor with a throw-away phrase popularised by a sci-fi writer? That's just unforgivable.
Admin
But seriously, didn't I see this same exact article yesterday on thedailywtf.com?
Admin
Admin
This new wtf is much less of a language wanker, eh?
oops!
Admin
FTFY
Admin
i can haz new wtf?
Admin
Admin
Admin
Admin
I think this code is more an example of Sweeny Todd's razor.
Admin
Admin
Yesterday we thought that today would be tomorrow. But now we know better.
Admin
I thought you were only supposed to be doing that kind of experimentation in college.
Admin
Admin
Captcha: nulla - you got that right!
Admin
Admin
Man, you corny!
Admin
Admin
And without running srand the code is actually deterministic on some configurations.
Admin
Careful, some people donated around one trillion (Zimbabwean) dollars to this site. You'd think for that kind of dough, you'd expect > 80% uptime.
Admin
Thing is though, an inability to tell the difference between black and white, per se, does not make one any less safe on a zebra crossing while walking across it. Now if the driver were unable to tell the difference between black and white, they're obviously either in sales/marketing or blind, which could be an issue. But in either case I think they should be denied a licence in the first place.
One based upon the lack of eyesight, the others on basic lack of clue.
Admin
Admin
While I agree that the GenerateRandomError() function is nasty, is it ever called? I assume that this part of the code:
would always return false, as strong is declared as a variable not a function (unless it's just not been included in the story); ergo, the last else would never be reached.
Admin
Eh, you don't know javascript do you?
Admin
For you guys across the pond, you missed a truly terrible article today. It had spelling errors, it was likely made up, and it was written in a confusing manner. Due to the number of negative comments, Alex decided it was best if he took the whole story down.
I would say "sorry," but trust me: you did not want to read that article.
Admin
Funny thing is, I read this article, then clicked "Random" and got this one:
http://thedailywtf.com/Articles/Password-Perplexity.aspx
I believe we found an end user of this system.
Admin
Shouldn't this code be in a business logic layer?
Admin
Did the development group come clean and explained to users/management the cause of the error? Or did they simply fix it and kept it quiet?
Admin
Admin
Admin
I find it amuzing that 'password' has been spelled correct and incorrect on the same line.
Admin
Admin
WhereTF is a story for today? What does the "daily" stand for?
Admin
Admin
It is simply evil genius at work here. How else can you explain the thought that went into building this random error generator? The developer actually went through the trouble of using the Math.random function to trick the lazy debugger into thinking there's Heisenberg's uncertainty principle at work.
I hereby vow to use and improve this random error generator and use it somehow in any of my forms! Until all users go mad! Such is the power of the Dark Side! Mwahahaha!!!
Captcha: sino => the Sino-WTFian relations are improving!
Admin
Don't you know? Drivers are only obliged to stop when the pedestrian is on a white bit. Drivers know this instinctively, but pedestrians are apparently oblivious.
Admin
Further notes on the subject, culled directly from the Hanlon's Razor page on Wikipedia:
General Kurt von Hammerstein-Equord in Truppenführung, 1933: "I divide my officers into four classes; the clever, the lazy, the industrious, and the stupid. Each officer possesses at least two of these qualities. Those who are clever and industrious are fitted for the highest staff appointments. Use can be made of those who are stupid and lazy. The man who is clever and lazy however is for the very highest command; he has the temperament and nerves to deal with all situations. But whoever is stupid and industrious is a menace and must be removed immediately!"
Now mentally divide your co-workers into those four categories.
Admin
Admin
Are you short and fat with fat stubby fingers?
Admin
Admin