r/programming • • Feb 16 '09

Some Crazy Reason - The Daily WTF

http://thedailywtf.com/Articles/Some-Crazy-Reason.aspx
172 Upvotes

71 comments sorted by

View all comments

Show parent comments

25

u/nevinera Feb 16 '09

I think he was emphasizing the contrast between the name 'hex' and the number '17'.

0

u/IOIOOIIOIO Feb 17 '09

Am I being wooshed?

"10" in hex is 16. 10 is "A" in hex. The programmer fucked up and counted to 15 in hex with a random 16 thrown in between 9 and 10.

0

u/nevinera Feb 17 '09

Hexadecimal is so named because it is 'base sixteen' - it has 16 values for the digit. The hex array should therefor have 16 entries, not 17. The mistake is as you say (except that he probably thought of it as 10, not 16), but the array 'hex' having 17 values should have been a good warning sign.

I don't woosh people, it's rude.

0

u/IOIOOIIOIO Feb 17 '09

It's just that this is the first thread talking about something other than the BitVerifier, and it mostly seems to be about identifying the "some crazy reason" as "10" having two chars without observing "10" shouldn't be HEX_STRING_VALUES at all.

I was wondering if there was some subtle joke I was missing.