Checking return values of system calls
Chip Salzenberg
chip at ateng.ateng.com
Sat Jan 7 08:38:07 AEST 1989
[followups directed to comp.unix.wizards]
In article <448 at myab.se> lars at 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 at 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 at 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."
More information about the Comp.unix.wizards
mailing list