- 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
You heathen! ;-)
Admin
Admin
Admin
Admin
I'm pretty sure that the original coder had kids, and that he/she had learned that it is usually not enough to tell them once. But if you have to tell then more than five times then you can: (a) let them have it their way ("no dinner tonight, then") (b) do it yourself, or (c) put up a fight. I also think that okThatsItYouAreGrounded() was not implemented at that time.
Admin
Erm... That would be a correct belief.
fprintf returns a negative number on failure AND sets errno, OR returns a positive number of bytes on success.
Admin
Although he did manage the official programmer misspelling of "occurred" (noun form: "occurance", for double misspelling points).
...phsiii
Admin
Since absolutely no one else has thought to correct you yet, let me jump in here and say that fprintf does, in fact, return a negative value on error.
Admin
That's right - form is so much more important than function! The code above is clean and easy to maintain ( so important to the majority of the WTF readers ) - should have at least one comment per line, though. How else can you justify spending so much time on worthless (Only in terms of function) code?
Admin
No, it's just error-handling taken to the extreme. A lot of people don't realize that common everyday functions could fail, and then don't handle the error. Let's take a classic program:
Can you spot where it may fail? (Yes, this program has a potential bug). (Hint - what's the prototype for printf(3)?).
Now, whether or not the failure of a printf() or sprintf() function is something to worry about. If you actually wanted to code it properly and handle the cases where it failed, you'd add enough lines to turn this trivial program into something non-trivial. Such is the nature of robust programming.
Admin
Admin
Hello! decdcce interesting decdcce site! I'm really like it! Very, very decdcce good!