- 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
Maybe a nasty parting gift left by a disgruntled dev?
Admin
Exactly my thought.
And an unsophisticated one; if I were him or her, I would have scrambled it with calculations and table lookups, at least.
Admin
Or a developer inserted it to test the invalid-date branch, then forgot to remove it.
Admin
How did it ever work if it assigned 2012 to YEAR every year, the result of which would be nonzero?
Admin
Not every language requires two equals signs when you want to test. Some use a single equal sign to indicate assignment as well as testing values. I think all the ones mentioned in the article do, but maybe there was another one in the mix that didn't. Or, it's just a typo.
Admin
Now if it was 2020, then I would accept that calling it an invalid/terrible date would be justified.
Admin
Something was supposed to change in 2012.
Admin
The Aztec calendar was supposed to end in 2012, but in December.
Admin
Not to mention Pascal, which uses
:=
for assignment=
for equality test...Admin
Seems pretty trivial compared to some of the date parsing nightmares I've found in the twenty years since all the hoopla over how planes would fall out of the sky, etc. First one being Feb 2001
I thought we were going to hear how this guarding against some brittle third party module that would assume the date was December 2020 when it saw 2012 and launch the missiles or something. .
Admin
That was my guess.
Admin
Amusing.
With that deletion, you removed support for the Mayan calendar. It ended on 21 December 2012. Or so went the expectation.
Admin
I think this snippet is written in pseudo-code, to avoid all irrelevant details of the language itself.