In my opinion, error checking should be included, since there is a critical mass of programmers who are, in effect, "home schooled" in the languages they currently work in. Expert programmers will have programming habits (both good and bad) that will cause them to error check or not independent of what is in the examples provided, and novice programmers can only benefit by increased exposure to better code (code with error checking included).
I suspect (but could never prove ;^) that most programmers are working day-in and day-out in a language they were never formally schooled in, so there is little re-enforcement of good programming practices in their current environment.
Adding (an estimated) one line per function call in a programming text is a small burden, and I suspect that Andy's ten percent estimate is heavy, based on my own entirely superficial review of chapter 13 of Steve Oualline's Practical C Programming.
Steve's chapter on Simple Pointers has the following attributes:
- 17 printf (or fprintf) function calls
- 10 function definitions
- 13 function calls
And a solid page of code appears to be 52 lines, given the typical page and font size for an O'Reilly book (as printed out). Now this particular chapter prints out at 24 pages. To add simple error checking, even if it were three lines per function call would add about a page and a half to the length of the chapter, a five percent increase in size.
Of course, this is one of the more wordy</> styles of books O'Reilly publishes, but the example is useful (IMHO).
Disclaimer: As a programmer turned software tester, I have an unbiased view on this topic...