[comp.unix.microport] Checking return values of system calls

chip@ateng.ateng.com (Chip Salzenberg) (01/07/89)

[followups directed to comp.unix.wizards]

In article <448@myab.se> lars@myab.UUCP (Lars Pensj|) reminds us that
all programs should check return values of system calls, such as write().
This is obviously good policy.

However, according to debra@alice.UUCP (Paul De Bra):
>... unfortunately very few programs actually do this for read and write...
>Reasons are obvious: programmers are a bit lazy, and the programs become
>smaller and faster if you don't check. (so not checking also makes your
>system look better in benchmarks which use standard utilities...)

This misconception about "efficiency" is, alas, all too common.  Checking
the return values of system calls takes some programmer time during coding,
but this is more than returned during debugging and use. ("A bit lazy"?  Try
"lazy enough to get fired"!) And as for execution speed: how long does an
integer comparison take?  Certainly not enough to worry about, once you've
accepted the overhead of a kernel trap.
-- 
Chip Salzenberg             <chip@ateng.com> or <uunet!ateng!chip>
A T Engineering             Me?  Speak for my company?  Surely you jest!
	  "It's no good.  They're tapping the lines."