Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!nbires!isis!ico!ism780c!mikep
From: mikep@ism780c.UUCP (Michael A. Petonic)
Newsgroups: comp.unix.questions
Subject: Re: write (fildes, buf, nbytes) -- is "nbytes" int or unsigned?
Message-ID: <6975@ism780c.UUCP>
Date: Fri, 24-Jul-87 15:22:01 EDT
Article-I.D.: ism780c.6975
Posted: Fri Jul 24 15:22:01 1987
Date-Received: Sat, 25-Jul-87 23:37:17 EDT
References: <868@bsu-cs.UUCP>
Reply-To: mikep@ism780c.UUCP (Michael A. Petonic)
Organization: Interactive Systems Corp., Santa Monica CA
Lines: 34

In article <868@bsu-cs.UUCP> dhesi@bsu-cs.UUCP (Rahul Dhesi) writes:
}My System V Release 2 documentation as supplied with Microport System
}V/AT says:
}
}     int write (fildes, buf, nbytes)
}     int fildes;
}     char *buf;
}     unsigned nbytes;
}
}This is incorrect:  since write() normally returns the number of bytes
}written, its return value should be of the same type as nbytes; but
}since it can return -1, its return value must be signed.  Hence nbytes
}should not be unsigned.  In "Advanced UNIX Programming", Marc J.
}Rochkind describes the write() system call with the same inconsistent
}parameter declarations.
}
}The real problem is that if I declare and use write() correctly, lint
}complains, because the lint library wants nbytes to be unsigned.  And I
}don't WANT to declare it incorrectly.
}-- 
}Rahul Dhesi         UUCP:  {ihnp4,seismo}!{iuvax,pur-ee}!bsu-cs!dhesi


According to the SVID (System V Interface Definition), AT&T differs
from the /usr/group proposal by having nbytes be of type size_t 
(typedef'd in an included file) which is an integer.

I think the SVID also mentioned that size_t was going to be changed
into an unsigned, but I don't know when or in what release.
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The company and all my associates and friends and ESPECIALLY the 
government put me up to say all this useless trash.
MikeP    {seismo|sdcrdcf}!ism780c!mikep "Some of my best friends are Bigots..."