- 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
Admin
I'm sure it varies between schools. My 2nd or 3rd CS course was intro to software engineering. At that point I probably made equally stupid mistakes.
Of course if this was an upper division software engineering course... then, yeah...
Admin
The error handler-
mOwner.mLogger.Warn("Input Error: %s is not 0-9 or A-F", strDigit);
//Should I crash or not?????
Probably will crash...
strDigit is a char[1] not a null terminated C string which is what the %s specifier usually means - but who knows with this lot. Prob should be ..."Input Error: %c is not 0-9 or A-F"...
Agree with the comments about using student code though - we all have to learn by our mistakes.
Admin
The site should have a special hit counter to list how many people that claim that come back the next day to troll again ;;)
Admin
I have to agree with the rest of the peanut gallery. For students, this is actually pretty good code, inasmuch as it actually works.
To the person who decided to post this as a WTF: This code is awkward and poorly designed, but so were you when you were young.
Admin
You did notice that
Even if the strDigit buffer is fixed to accomodate two characters, this code is a horribly inefficient mess.
And you think given all of this there is no WTF? If that is your attitude towards software quality, I'm sure this site will hear of you, one way or the other.
Admin
No, it might just happen to work on some C++ implementations.
I was poorly designed when I was young? Well then, blame it on the designer.
Admin
I am the original submitter of the code. I don't know why this was posted as "student code". This was NOT student code. This was "co-op" code. He WAS being paid to write this code, although he is still in his last year of university. He has 3 years of C++ experience and should be expected to write better code than this.
Besides, quit your damn whining and laugh at the funny code man!
Admin
First of all, as I mentioned elsewhere, this was NOT student code, and I don't know why they posted it that way.
Second, if you think this is "pretty good code", then I imagine you've been featured on WTF at some point as well.
Third, I can promise you that I never wrote anything this bad even in university. Some people just "get it" when it comes to programming, and some people clearly do not.
Admin
WTF. Are you serious. If you are, look at this
Admin
very well said...
Admin
I've your learning a language and have no clue about data types and binary representations... You skipped a few lessons.
Thats the WTF for me here.
ps; 'A'!='a' in Hex??
Admin
The bug should be obvious people - the method signature returns a char instead of an int.
Admin
Agreed in principle, but you can expect a student to make a go of understanding what they are doing, surely?
Some of these are up there with "Sir Francis Drake circumcised the globe with a 100ft clipper", or "The pyramids are a range of mountains between France and Spain."