- 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
To be fair, maybe it took them a minute to figure out what it did, another hour to argue over why it was done that way, maybe another 2 hours going off on a tangent arguing about whether a byte is defined as 8 bits in the C standard. And then an hour trying to write something witty about it so they could send it to TDWTF.
Admin
Easily spotted the real WTF: there exists no such thing as a "good reason to use VB instead [of anything]".
Admin
Makes complete sense if this was an "End of month" function, it's just been extrapolated for end of year.
Admin
What about preprocessor abuse exploiting the ternary operator. I've seen something basically like this (I might have the details wrong, it's been a while):
So you could use
to get the start of the VGA range. Pretty clever.Admin
It's possible the code actually was fiscal-year based, and the fiscal year ended in June, which only has 30 days. One day, administrative changes restructured the fiscal year to end in December and align with calendar year, but nobody bothered to change the code since it still works fine because the programmer took into account that the fiscal year-end date (month) could change someday...
Admin
Or maybe to support clients with different languages at the same time?
Admin
You should also be checking for worse than failure.
Admin
If x >= &HC0000000 Then ... End If
Admin
This is a great piece of code, not only will it work on Earth, it'll also work on any planet where his function is used.
Admin
Really. Who cares? By the time you get to see the "1 comments", there are more comments and you don't have that anymore. No matter how complicated it is, there's no payoff. It occasionally prompts a comment like that, which starts a real flurry of activity. And the hit count goes up, and the popularity grows. So why fix it?
Sorry. Just me feeling peckish this morning. Really!
Admin
I find your confidence in Visual Basic to be ... disturbing.
Admin
Admin
Clyde's code might work for now, but what happens if the world suddenly decides to switch back to the French Republican Calendar?
Admin
Isn't &HC0000000 a negative signed integer in VB? You need to put an L on the end so its interpreted as a positive long.
Admin
Admin
I'm going to say this one is not a WTF.
Rather, it's a result of an overly-strict rule against no magic values.
Admin
WTFSupport: Hello, TDWTF Support line Caller: Yeah, your page says "1 comments". Clearly there is something critical wrong. WTFSupport: Ummm, could you try refreshing the page? Caller: Hey it's fixed!
Admin
You've obviously not worked in embedded systems. I've come across quite a few C compilers for oddball processors which don't support //. Haven't yet found one where a char is anything other than 8 bits, though.
Admin
That's just called getting the most out of your tax deductions.
Admin
[quote user="SomeDude"]The real WTF is this:
[quote]we had good reasons for choosing VB instead.[quote]
[/quote]
ugh... Why do there have to be so many C bigots in the world?
Admin
If you are doing that, than do it right. Why that idiotic 60-based minutes and hours?
10 months of 36 days, of which the first five have an extra day. 1 week = 10 days (7 days work, 3 days weekend, with a little bit more spare free days to make up) 1 day = 10 dhours (= ~2,5 hours) 1 dhour = 100 dminutes (= ~1,5 minutes) 1 dminute = 100 dseconds (= ~0,9 seconds)
Admin
My favorite C programmers mistake when writing VB (6) code:
Dim foo, bar, widgit as Int
foo and bar are variants, only widgit is an Int. MS fixed in VB 7.
Admin
meh, it looks like failed Y2K-handling code.
the problem appears to be that either iyear or datYrEnd_Dt is suspect somehow, and he wants to validate them against each other.
but the transmorfation applied ensures only that datYrEnd_Dt is in iyear. it does not ensure datYrEnd_Dt is the last day of iyear.
left as exercise for reader.
Admin
This isn't that annoying is it? Reminds me of when I used to work at a (U.S.) company that used Lotus Notes as their e-mail, and had an office in Austrailia. A read receipt from an e-mail we sent there in the afternoon would often come back: "Your message has been read tomorrow at 8:03 AM"
Admin
Useless fact: Most of the world's deciduous forests are in the northern hemisphere, and this results in a seasonal variation in the speed the Earth rotates.
The real wtf is they bothered setting that boolean to it's default value of False before using it...sure it might be a static with a previous value, but I can't see why that would be the case given it's purpose.
Admin
Admin
I have read 2 pages of comments, out-smarting each other (plus some puns I deeply appreciate ^^), and maybe I'm missing a collective joke, but did it really occur to no one that this is a plain leap-year check?
In pseudo-code:
if year-of("01/jan" plus 366 days) == year-of("01/jan" plus 365 days) then leapYear = true;
Or at least that's what he intended, I guess. I have no idea if the code presented really works like that, but I can see how a former C programmer might think like that.
Obviously, the author is not a native english speaker and chose to call leap years "skip years". Consequently, bSkipYearCheck = True doesn't mean "please skip some special year check" but "the check for leap year was true".
Of course, it's a lot of speculation since the code fragment is too small, but this way it actually makes sense (notwithstanding the fact that it is convoluted, probably broken etc.).
It is sad that people are so fast at jumping on code they don't understand and criticizing it for all the wrong reasons.
Admin
The WTF is that the guy didn't write comments.
Admin
Will you marry me?
Admin
Admin
Wouldn't make much sense. If they person is already infected with the same meme, then converting that person doesn't further the spread of the infection.
What you want is a person infected with a different, perferably competing meme. Then, converting them not only strengthens your side, but weakens the other. Double word score!
Admin
Admin
Admin
Admin
Mistake that Pascal programmers make when writing C code:
int* foo, bar, baz;
Only the first is a pointer to an int; the other two are ints. Microsoft fixed that in C# by removing the pointer type.
Admin
You foolish, foolish fools! When Clyde's solar repeller is complete and he pushes the Earth into a new orbit, you'll WISH you had that check to maintain your data with! I will admit that, to some, his evil genius plan might be lacking on the reward side and heavier on the effort side, but what mastermind starts with galactic conquest and works his way down?
He'll show you all. OH YES, HE'LL SHOW YOU ALL!
Admin
cuz i was doin her. last... night. when, she, uh... said that...whut, uh... whut she said.
genitus: we don't post captchas cuz they're funny or appropriate, we just post them to help out the spambots...
Admin
That is mostly because // is from C++, not C.
Admin
I've seen a char not be 8 bits. Texas Instruments' VC33 processor has 32-bit memory. Bytes are not addressable, and the compiler makes everything be 32 bits.
Floats, doubles, ints, shorts, chars, it doesn't matter. Every one of them takes up 32 bits, and sizeof returns a 1 for all of them.
Chars only use 8 of the 32 bits though, which means that constant strings are kinda wasteful.
Admin
A lot of things happen at quarters of years, especially in the financial sector. Would be really nice to have 13 months instead of 12.
Admin
Honeywell Level 66 mainframes (later DPS 8, DPS 200) had 9-bit bytes. Yes, the words had 36 bits in them...
Admin
Admin
ba-dumf-tisshhhh
Admin
Admin
Admin
A machine that only does capital letters (say, a calculator, or other embedded device) doesn't need 8 bits to store a character. The size of the byte is dependent on the target architecture, and the features it supports.
As another example, an architecture whose addressable units of data storage are 16 bits wide has 16 bit bytes. Yes, these are out there.
Jebus H. Christ
Admin
I believe old CDC systems had 6-bit and 10-bit characters, with 60 bit words.
So we had 6, 7, 8, 9, and 10-bit bytes on the various systems.
Jeez, these youngsters, think a byte is always 8 bits (wonders off mumbling...)
Admin
Technically, it's a non-singular check (zero being neither plural nor singular):
0 comments 1 comment 2 comments 3 comments ... 10¹ºº comments etc.
Admin
Holy crap, this is the first time I've seen "meme" used correctly in a long time. Clearly cause for celebration!
Admin
If you want a good laugh, borrow Dawkin's book from a friend and look up the footnote where he says he must be right because his wife, the ex-Mrs Dr Who, says so.
I don't recommend buying it at an airport bookstall, like I did, because then you're stuck on a ten-hour flight with one of the most apoplectically dull and uninspiring books ever written. ("Toad-sexing for Beginners" was unaccountably out of stock when I enquired.) I considered gnawing off my own head as an alternative, but had to settle for organising a gang-rape of the Al-Qaeda operator occupying the window seat, thus staining his honour (amongst other things).
That's seventy-two less dried white raisins the little bastard'll be sucking on. But it's still ten hours of my life that Dawkins owes me, and I'll bet he welshes on the deal.