- 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
Which is a non-sequitur, because he's talking about that being a non-portable assumptions. Not all character sets are ASCII.
Admin
If you have to worry about those portability issues you must be working on some really funky hardware. The relations between shorts/ints etc is somewere in the(a?) C spec. short <= int <= long. Don't know the rest. :P
Admin
... which is not part of the C specification :_/
Admin
Admin
(a) I see your troll, and raise you a dwarf. (b) Perhaps you should try a search engine (c) Here's the specific important point. Go ahead, bore yourself silly ... well, go ahead, bore yourself anyway.
Then some other twit comes along, quotes (a) and (b), and snips (c).
I think it's fairly obvious that the underlying problem, which Dawkins tries to address in his reticent way with lecture tours, appearances in the media, half a forest full of books, and his incredibly brave work in the foothills of the Hindu Kush explaining why Mohamed was a raving lunatic and Buddha was an overweight princely upstart, is:
Self-appointed fundamentalist bigotry. Not "religion," after all; whatever that might be.
I'm not going to take this preachy smug crap from Christians, and I'm not going to take it from Atheists either.
Other than learning the simple courtesy of accurate quotation, you might want to brush up on your search engine skills, too. They work on a ranking system, you know. Try typing "popular book Richard Dawkins" into Google and you'll be able to guess the book to which I was referring.
Yes, it's "The Selfish Meme," victim of a tragic type-setting error at the publishers... And of course we're both assuming that Idiot Number 1 was not already aware of the book in question -- which is a disingenuous proposition, to say the least.
Admin
Speaking of which, I liked that book by Isaac Asimov. You know which book I mean, look it up.
Admin
Way to go to miss the point, anonymous boy. Or maybe, as a distinguished co-worker of mine used to remark, "I don't like to read. It just hurts my eyes."
Admin
Wow. Just... wow. I think I just ground off a few mm of my teeth while reading your post. I never read a post that made me instantly dislike someone that much. Good day to you sir.
Admin
This looks like a Y2K bug check. I've seen it done before. Get the end of this year, add one and get the new year. If the computer suffers the Y2K bug in that particular piece of software (or maybe the BIOS), and it happens to be 31/12/1999, the new year might be 2000, or it might be 100, or 00. Subtracting one will obvious then give a different result, thus confirming Y2K non-compliance.
Admin
Admin
TRWTF: it took us half a day to figure it out.
Actually, this is a pretty good way to deal with issues that may arise from changing locale. With the check that you propose, you'd never get to the end of the year in Europe. Of course, you can hope they'd be too busy celebrating the new year and your program would never run on the 31/12/iYear
George
Admin
Admin
Admin
This is definitely not a WTF. The purpose of the bSkipYearCheck variable isn't clear, and there should be a comment explaining it, but the actual logic seems to say "Is tomorrow next year?" which is totally reasonable. If you already have a bunch of code that knows how many months are in a year and how many days are in each month then why not actually use that code instead of hard-coding extra logic like (month=12 And day=31) that bypasses it?
Also, considering all of the exceptions involved in calendar logic, if this article had claimed that December only has 30 days, or has 30 days sometimes, I would not have spotted that as an obvious falsehood. If I had to write code to do this, it would have been more time-consuming to make it check a specific day (because I'd have to first look up online how many days are in December and verify with multiple sources that it's really always 31 with no exceptions) than to write it like this. And in the end it would be harder for other people to verify because they would probably have to go through the same process to make sure a hard-coded 12/31 is always correct. Just because a magic number seems obvious to you at the time doesn't mean everyone who will look at your code will trust it as much as you did.
Admin
Admin
Admin
Admin
Oddly enough, I don't dislike you. In fact, I'm pretty sure I've never met you.
Hello, gorgeous!
Admin
Not that anybody cares, and not that TDWTF is anything to do with decent analysis rather than idiots chucking out "I'd have done it this way" reams of code, and anyway, it's far too late in the thread for anybody to care.
But still. This is horribly plausible.
Admin
I don't hate Dawkins. That would be absurd. The man's an Oxford Don, for God's sake -- and not all of them are perverted, drunken sots. (Well, it's been twenty five years. Maybe some of them. Not all.)
To clarify, I hereby accuse Dawkins of being "smug/preachy/patronising..."
... but I have no serious philosophical or logical objection to the concept of memes as an analogy/metaphor/model.
How could I? Is the sky blue/falling down/fish?
Analogies, by their very definition, are meant to lead somewhere. I don't see this one leading anywhere. In the course of checking facts (yes, I do that now and again. Once I was an academic historian. Now I'm stuck on a site full of ignorant children who can't be bothered and use selective quotation -- not you; a reference to the twits above) I looked at the Memetics entry:
"The memetics movement split almost immediately into two."
I'd encourage you to read the rest of it. Anti-religious rants good it is for, young Jedi, but a parallel advance in the "social sciences" to quantum mechanics it very definitely not is.
Not nearly.
Addendum (2009-04-04 18:18): PS "Victim of a tragic type-setting error" was a joke, not sarcasm. Jokes are easily distinguished from sarcasm by causing strange and inadvertent hiccoughing noises for those that read or listen to them ... which sarcasm fails to achieve, generally.
I'll go back to the drawing board, but I'll be here all night. Have you seen my rubber chicken? She used to be my mother-in-law, until I bought her Ludwig's Tractatus Logico-Philosophicus. Have you heard the one about the rabbit and the ironmonger? ed: this one's actually funny, for a change. Look it up, sub?
OK. Here it is. Serious point. I'm distressed by unthinking absolutes, and that's what I see here. I'm bored by Dawkins, but it's fine by me if other people get their rocks off reading a (fairly dull) book.
Just don't buy it on a trip to California to save your ex-girlfriend and her twelve year old daughter from the results of an amphetamine addiction, which is what I did.
I think I'm justified, here, in the following outrageous and entirely personal claim:
Dawkins is a fucking idiot. And so is anybody who parrots his words without at least a modicum of thought first.
Admin
Admin
This is not Future-Proofing. This is Maybe-They-Do-Not-Use-Gregorian-Calendar-Proofing.
Admin
murphy@seasonsend:~ $ grep -R CHAR_BITS /usr/include/ murphy@seasonsend:~
You were saying?
Admin
if (Math.Random < 0.5) { ... }
You never initialized x. ;)
Admin
Actually quite the contrary, I quite frequently work with embedded systems. Generally though for me this means an ARM based processor with GCC. No problems there. About the only embedded processor I can think of where I haven't used GCC would be a PIC. Can't quite recall if Microchip's compiler handles // or not...been too long. I want to say yes though.
Admin
Some things just seem more plural than others.
Oh, and does anyone have a link to the thread with all those comments? Given the tendencies laws of internet forums, I'm curious what that eventually devolved into.
Admin
Admin
Admin
Unless you are the one paying him how is it any of your business?
Admin
Admin
It's not future proof, but it's culture proof.
Not all culture use the Gregorian Calendar. Some Arab countries use Hijry calendar where the the number of days in a month may vary from year to year.
The hebrew calendar leap year has 13 months.
Checking for 12/31 will work only in Gregorian calendar.
Admin
Admin
Shouldn't it be:
do forever /* whatever */ doesntend
Admin
Admin
I'd prefer to develop the engineering skills needed to modify the Earth's rotation and revolution slightly so that they're exact multiples of each other and of some convenient integer. Why should we put up with the sloppy approximations nature gave us? (Aligning it to the seven-day week as well will be trickier....)
Admin
has C ever been supported on a 12-bit byte machine (e.g. pdp-8)? i'm sure there have been mainframes and other such things out there that had minimal addressable units of 16 bits.
Admin
mac's "friendly" date format (in Mail.app, the Finder, etc.) will say "tomorrow" when appropriate.
Admin
trwtf is that you're not using ack
Admin
WTF is ack?
Also, CHAR_BIT is defined, although CHAR_BITS is not.
Admin
That reduced rotational speed is however compensated for by the earth drifting away from the sun, causing its orbit to grow longer. Whether those effects will combine to yield more or less days before this system goes offline remains to be seen.
Admin
Re: Ethiopia has such a calendar now. In fact, their Ministry of Culutre and Tourism uses the slogan "13 Months of Sushshine."
Well the 13 month calendar is what the Mayans advocated long time ago, in fact it was the Catholic Church that came up with Gregorian Calendar that doesn't ""go with the flow"... maybe one day we will learn to go back to balance.
Admin
That's a religious thing as well.
NB - Not just Pentateuch based religions, but others as well - seven days a week is probably because (a) there are seven visible heavenly bodies which move across the sky (see the names of the days of the week which are based on their names), and (b) the phases of the moon last seven days. (You can juggle with cause/effect to please whatever your religious beliefs are:) )
Admin
The code is bug-free, simple and easy to understand. As others said before me, the WTF is really that so many people seem to think this is a WTF.
Admin
The real WTF is why spend a half a day on this piece of code. And why is the programmer allowed to spend a decade on it ?
That's the real WTF of this article.
Admin
I actually think this code is better than the alternative 'check for December 31st' method.
If it was checking for Christmas Day by adding 7 onto the day and checking if the year was the same, then that would be a WTF, but this test is checking 'Is this the last day of the year?', NOT 'Is today the 31st of December?'.
If code is meant to be self documenting, then it seems that the original code said that the test was for the last day of the year.
If it checked for 31st December, then you might wonder 'why that particular day?'. That's introducing a couple of 'magic numbers' which aren't necessary. A check for 31st December MAY be a check for the last day of the year, or it may be the boss's birthday, or it may be the day to watch out for swans, or the anniversary of the chartering of the British East India Company, or whatever.
Admin
For the record, CHAR_BIT is guaranteed to be >= 8.
Admin
Not really an official source, but too early in the AM...
http://stackoverflow.com/questions/653289/bit-shifts-in-c
I don't think anyone would be masochistic enough (any more?) to design using BCD as an internal native representation!
Admin
Admin
We celebrate on the 30th, and he just had to get his birth certificate corrected, so there hasn't been any hassle that I know of.
Admin
ack is better than grep