Submission for comp-unix-microport

UNIX-UNIX Cp uucp at tolerant.UUCP
Sun Jan 8 04:40:25 AEST 1989


Path: tolerant!voder!apple!claris!ames!amdcad!sun!pitstop!sundc!seismo!uunet!ateng!chip
From: chip at ateng.ateng.com (Chip Salzenberg)
Newsgroups: comp.unix.wizards,comp.unix.microport,comp.emacs
Subject: Checking return values of system calls
Message-ID: <1989Jan6.173809.15868 at ateng.ateng.com>
Date: 6 Jan 89 22:38:07 GMT
References: <828 at ubu.warwick.UUCP> <28173 at tut.cis.ohio-state.edu> <10960 at bigtex.cactus.org> <8791 at wright.mips.COM> <1138 at csuchico.EDU> <429 at lehi3b15.UUCP> <121 at cbw1.UUCP> <8525 at alice.UUCP> <448 at myab.se> <8547 at alice.UUCP>
Followup-To: comp.unix.wizards
Organization: A T Engineering, Tampa, FL
Lines: 22

[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.microport mailing list