- 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
The one who says "Nice historically, but I don't bother with arrays much any more - I use Lists and ArrayLists and stuff like that" is probably beyond help.
Admin
I put them in two categories: languages that use 0-based indexing and languages that I do not want to use.
Non 0-based indexing indicates that the language designer doesn't understand how abstract data types work, and the separation between interface and implementation.
Admin
Admin
Admin
Admin
Admin
If you're a programmer and don't like imperial you're in the wrong business, imperial makes sense on computers: 1 Gallon = 128 oz 1 Quart = 32 oz 1 Pint = 2 Cups = 16 oz 1 Cup = 8 oz
Admin
Ah! As a counter-example I suggest you look at Ada; Ada's arrays start at anywhere you need to, but provides such attributes as 'First, 'Last, 'Range and 'Length so that you can manage the array effectively. The 'Range attribute is particularly nice because you can then write for-loops like:
The array example above has been doable since the beginning (Ada83) and combined with Ada's type/subtype system can be quite useful; such as having arrays of enumerations (which are NOT integers themselves and so cannot start at either 0 or 1) and the use of unconstrained arrays in parameters means you can write generalized functions which operate on sections of an array w/o monkeying about with translating indecision.
{The new Ada2012 has an even more generalized for-loop which can operate on the containers.}
Also, take a look at Ada's package spec/body separation; nicely done.
Admin
Admin
Yes, of course ArrayList is backed by an array. But I struggle to come up with an advantage of T[] over List<T>.
Admin
int _x[256]; int * x = _x+1;
Admin
Ah, so Java got pointers now? Cool.
Admin
Admin
Admin
Imperial: 1 Gallon = 160 oz 1 Quart = 40 oz 1 Pint = 2.5 Cups = 20 oz 1 Cup = 8 oz
Imperial has the advantage that dry measurements are the same as liquid measurements (except that a gallon is called a bushel in dry measurements).
In the US, dry measurements are the same as imperial. Only US liquid measurements are WTFs, which make sense on computers but which are still WTFs because they differ from everything else.
1 imperial ounce = 1 US dry ounce = 28.35 ml. 1 US ounce by weight = 28.35 grams, oh look, consistency. 1 US liquid ounce = 29.4 ml. 1 troy ounce by weight = 31.1 grams.
Well, metric also has the advantage that dry measurements are the same as liquid measurements. And there's only one version throughout the world. None of that nonsense like 1 ml differing from 1 cc in the sixth decimal place because the measurement of an underlying object had improved between the times of those two definitions ... ooops.
Admin
This may not actually be a WTF, at least not directly. It looks like the panels were redesigned at some point, which in some way changed all of the indices. Rather than figure out where the panels were referenced and do the translation there, they thought it would be easier to make this map to translate from old panel index to new panel index.
Assuming this is the case, the real WTFs are:
Admin
I'm going to guess that they needed to expand the number of pages, while also retaining backwards compatibility with some not-so-well-thought-out legacy numbering scheme. If so, that would have been good to mention in the comment, though.
Admin
Don't ask, the answer is 42 anyways.
Admin
:-)
Admin
hahaha. I Work there currently FML
Admin
Could just as easily be JavaScript.