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: Re: Bad Pointer Declaration in 'scandir' Message-ID: <2491@dalcs.UUCP> Date: Mon, 30-Mar-87 07:26:00 EST Article-I.D.: dalcs.2491 Posted: Mon Mar 30 07:26:00 1987 Date-Received: Tue, 31-Mar-87 04:57:53 EST References: <2479@dalcs.UUCP> <5916@mimsy.UUCP> Organization: Dept. of Math., Stats & C.S., Dalhousie University, Halifax, N.S., Canada Lines: 24 Keywords: scandir, C, pointers, man Xref: utgpu comp.lang.c:1377 comp.bugs.4bsd:252 Summary: Pointer to abiguous-sized array allowed? Minor point: In article <5916@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: > >read] struct direct *(*namelist)[]; > > No: for there is no such thing. A declaration for a pointer to an > array must specify the size of the array. In fact, what both the > code and the manual *should* say is > > struct direct ***namelist; I disagree with this. I think a pointer to an array need not specify the array size. The compiler (all the one's I've dealt with) will allow this omission of array size. In many cases, it is required to be able to allow pointers to different size arrays being passed to a function. struct direct ***namelist will work exactly the same as *(namelist)[], but the latter is a bit more intuitive (if you can call *any* C declarations intuitive). A pointer to an array of pointers to ..... is what the beast actually is. A pointer to a pointer to a pointer to .... will work the same, but leaves a little bit to be desired in the understanding of it. dalegass@dalcs.uucp