- 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
static bool first = true;
Admin
"of which the following code is a part of"?
Admin
Admin
Sure - it's from the "Live and let die" school of grammar: [quote user="The Beatles"]But in this ever changing world in which we live in[/quote][/quote]
The Wings, not The Beatles
Admin
Admin
or perhaps
Admin
Surely just Wings (unlessmy sarcasm detector has been unplugged)?
Admin
Yup, that sounds about right to me! An office that doesn't even have a single arcade machine isn't worth going to every day!
Admin
Wings, not The Wings. (just keeping in the nitpicky spirit of TDWTF)...
Admin
That fails to account for the two other cases (when STATUS and self-active share the same status). I don't know if it's right to do so or not, mind you.
EDIT: Rectified in my next comment. Why can't I delete my own comments? (I know, Community Server...)
Admin
This won't do: it behaves correctly on the two other cases (when STATUS and self->active share the same state).
Admin
If to nitpick, then I guess the "The" in "The Wings" wasn't meant to be part of the band name, but used as a definite article.
Admin
Admin
I thought the lyric was "...world in which we're livin'". Which makes more sense.
Admin
Admin
My head spins after reading this and trying to figure out what it's doing. Or not doing, in a very complicated fashion.
Does this guy (the coder, not the submitter) really not understand how Object-Oriented code works?
Admin
it's
But if this ever changin' world In which we live in Makes you give in and cry
Say live and let die
Admin
Actually Paul McCartney sings "But if this ever changing world in which we're living"
It's Axl Rose that sang "But if this ever changing world in which we live in"... and he's realised his mistake because he sung it properly at the Gunners concert I went to last year.
Admin
There are games companies which try to filter out people who don't know how to code very well at interview. I used to work for one. Unfortunately I now work for a games company which accepts anyone who knows how to write syntactically correct code.
Admin
^ TRWTF ist right there!
Admin
I don't believe you It must be true No one could look as good as you
...where the actual lyrics are
I don't believe you You're not the truth No one could look as good as you
Admin
When did Arsenal start performing gigs. I'm intrigued, who sings; is it Wenger or is he on the drums.
Admin
void Lib::output() //which is a non-static member, as it should be! { STATUS = active; }
Would be better. It still doesn't solve the rather scare assignment of 'STATUS' there, but that would probably need a total redesign.
Of course, it MIGHT be that 'STATUS' is actually a hardware register, in which case the original complex boolean stuff might be necessary to avoid hardware register writes if data hasn't changed (but I doubt it...)
(PS - this is one of the first 'WTF's in a while which has actually had me issue that utterance)
Admin
But what if self->active was FILE_NOT_FOUND
Admin
ANDY GOTH=NO
Admin
May be, just may be, this "programmer"'s first language was Lua (we are talking about game companies here after all) and he didn't grasp the concept of static vs instance methods in C++.
To clarify - Lua doesn't have classes per se, instead there are "tables" - associative containers - that can contain functions as values. There's also some syntactic sugar to implicitly pass the containing table to a "member" function, thus emulating methods with this pointer, but there's no difference between a function declared with explicit this parameter and a function declared with the syntactic sugar/implicit this parameter. Which seems to be related to the WTF at hand. Also, the implicit "this" parameter is called "self".
Admin
I'm surprised that anyone expects video games to somehow magically adhere to a higher standard of code excellence. As an indie developer, I've worked with and written my share of bad code. Hopefully I'm at least trying to improve, but game development seems to get it from all angles.
Goals are unclear: You almost never know what you're making up front, since it's hard to design 'fun' on paper. It's exploratory software, unless you're writing Madden 2K-something.
Hardware is non-standard: PC games are a minefield of hardware issues, you often need special cases to handle the wide variety of configurations, or you limit your market appeal.
Budgets and time lines are often rigid: As we know, if you can't wiggle on cost and speed, you end up wiggling on quality. Front end quality isn't usually too bad, but keeping all those lofty design goals you had up front start to fall aside when the crunch hits. Since games tend to be throw-away code in the end, maintenance may take a back seat to software stability.
Oh, and we have our share of idiots. Guys and girls who 'just like' games, wanted to be a writer instead, have 'a great idea', who may or may not have learned how to code involved in the process. Software is software, and that's why I love coming here, to learn more about what does and doesn't work in other sectors.
Admin
Admin
Some people can write Fortran in any language. This guy writes Python.
Admin
Right now I'm in the process of teaching myself C++, and some of the stuff I do looks a lot like this. You know, trying if some expression will compile, and what happens if you write cout << &&*&varname;
This does not look like production code that 'does' anything to me.
Admin
Paul McCartney's Wings sang "Live and let die".
Admin
This is actually a known C/C++ practice: since first is declared static its value is kept across several calls to the function, so you only do the init the first time the function is called.
Admin
In keeping with the spirit...
The noun "Wings" is hardly an indefinite noun (in this context), requiring any kind of article.
Furthermore, adding the article could lead to entirely different meaning of the noun (i.e. "Looks like The Wings might be in for another run at the Stanley Cup this year!"). While most who are familiar with Paul McCartney's post-Beatles works and/or James Bond movies featuring Roger Moore would identify either statement in the given context, a man from mars may very well wonder how a hockey team in Detroit could be responsible for such an anthem.
</nitpicking>Admin
Admin
Only time will tell If our love Will stand the Test of Time
(--Van Halen, Why Can't This Be Love?)
Sammy needs to read the dictionary page for "tautology".
Admin
No, in this context the first flag is absolutely a bad practice. The IF-statement's body constructs the Lib object. There appears to be only one Lib object. So, why don't they construct it in the main block?
Admin
Andy = Nooooooooo!!!!!!
Admin
Admin
Except it's a horrible practice.
Pull everything inside the "if (first)" block and move it into an Init() function.
Admin
Sir, I would upmod you if I could! ;-)
Admin
I thought it was "If this ever-changing world in which we're living.." At least one online lyrics source agrees with me:
http://www.sing365.com/music/lyric.nsf/Live-And-Let-Die-lyrics-Paul-McCartney/8479C51B2F85A57748256A4C0008CAE9
Admin
I'm surprised noone has mentioned "self" up until now. C++ doesn't have "self", it has "this". There must be a macro someplace
#define self this
Clearly this programmer didn't feel at home with C++.
Admin
Or Smashing Pumpkins' "what I choose is my choice." Brilliant.
Admin
I Googled 'The Beatles' -- wow, just wow -- Paul McCartney was in another band before Wings!
The stuff you learn around here...
-Harrow.
Admin
look again, 'this' is used with the instance methods, the 'self' pointer was passed in to the static methods to make the pseudo-instance methods.
Admin
One night when the moon was bright on a moonlit glade
Admin
Admin
Admin
I think that still makes sense, as long as 'choose' and 'decide' don't reference the same Decision object. If presented with the Decision 'You are either with us or against us' you could choose neither option (presumably by raising a FalseDichotomyException) and still have made a choice (i.e. compile without errors).
Admin
That isn't dumb or redundant. That is deep and full of underlying truth.
Like my brother-in-law who quit Wal-mart so he could play games, a lot of people should hear that quote. Inaction is often worse than 'the wrong' action. His inaction is really a choice of shocking stupidity.