Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.wizards Subject: Re: Manual may mislead many mighty men. Message-ID: <12375@smoke.BRL.MIL> Date: 18 Mar 90 02:52:52 GMT References: <24407@uhnix1.uh.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 19 In article <24407@uhnix1.uh.edu> rr@cs.uh.edu (Ravi Ramachandran) writes: >On pg. 373 he says, "...oplist is a pointer to an array of semaphore >operations ..." >(It should be " oplist is an array of ..." ?) I think this confusion occurred because of the way that C arrays have traditionally been botched. The correct type for the second argument to semop() is (struct sembuf *), and it is expected to point to THE FIRST ELEMENT OF a user-defined array of semaphore operation structures. Because of the C array botch, most documentation (e.g. SVID3) has been calling this a "pointer to a user-defined array of ...". In pre-ANSI C implementations, it was not usually possible to construct a pointer to an array; an attempt to do so would be coerced by the compiler into a pointer to the array's first element. In ANSI C the distinction is important, and the words "the first element of" should be added to the documentation. Note that your suggested fix is wrong; a function parameter cannot have array type in either old or new C.