Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!dalcs!dalegass From: dalegass@dalcs.UUCP Newsgroups: comp.lang.c,comp.bugs.4bsd Subject: Bad Pointer Declaration in 'scandir' Message-ID: <2479@dalcs.UUCP> Date: Sun, 22-Mar-87 20:33:52 EST Article-I.D.: dalcs.2479 Posted: Sun Mar 22 20:33:52 1987 Date-Received: Mon, 23-Mar-87 07:21:03 EST Organization: Dept. of Math., Stats & C.S., Dalhousie University, Halifax, N.S., Canada Lines: 31 Keywords: scandir,C,pointers,man Xref: utgpu comp.lang.c:1300 comp.bugs.4bsd:236 I believe there is a incorrect pointer declaration in the unix 'scandir' function (or manual page, at least). This has caused me some headaches; the following definition claims to be a pointer to an array of pointers to the strcuture 'direct': struct direct *(*namelist[]); According to my understanding, this should be interpreted as an array of pointers to pointers to the direct structure, which would give dangerous results under certain circumstances. I believe what they want is: struct direct *(*namelist)[]; The old declaration may work since the memory is allocated, although with the extra level of 'indirection' defined, there may be subtle problems. Hopefully this is only in the 'man' page, and the scandir function itself is all right. Is this a real problem, or a fault in my knowledge of C pointers? *************************************************************************** Dale Gass, Dalhousie U., Halifax, N.S., Canada UUCP: {seismo|watmath|utai|garfield}!dalcs!dalegass.UUCP or dalegass@dalcs.UUCP ...!dalcs!dalcsug!dalegass.UUCP or dalegass@dalcsug.UUCP CDN: dalegass@cs.dal.cdn CSNET: dalegass%cs.dal.cdn@ubc.csnet ARPA: dalegass%cs.dal.cdn%ubc.csnet@CSNET-RELAY.ARPA