Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!cwruecmp!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon Allbery) Newsgroups: net.lang.c,net.micro.pc,net.unix Subject: allocating arrays Message-ID: <1181@ncoast.UUCP> Date: Wed, 7-May-86 18:21:12 EDT Article-I.D.: ncoast.1181 Posted: Wed May 7 18:21:12 1986 Date-Received: Fri, 9-May-86 10:44:56 EDT References: <200@pyuxv.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: net.lang.c,net.micro.pc Organization: North Coast Computer Resources Lines: 39 Xref: watmath net.lang.c:8899 net.micro.pc:8106 net.unix:7806 Expires: Quoted from <200@pyuxv.UUCP> ["Microsoft 'C' - Strange behaviour with doubles"], by cim2@pyuxv.UUCP (Robert L. Fair)... +--------------- | Consider an array of 15 pointers to arrays of doubles: | | double (*parray[15])[]; | | The following code to 'malloc' the actual double array barfs on Microsoft 'C', | with a 'different levels of indirection' warning on the '='. | The code passes through LINT, and compiles OK on UN*X 5.2 | | char *malloc(); | | parray[0] = (double*)malloc((unsigned)sizeof(double)*75); | | Microsoft produces the same error if the coercion is (double**), (double), | or nothing at all ! | | Any ideas ? +--------------- double (*parray[15])[]; means: an indefinitely-sized array of (or a pointer to) an array of 15 (double *) You want to allocate an array[15] of (double *)? ``double *parray[15];'' ...an array of 15 (double)? ``double parray[15][];'' My compiler (pcc) won't even TAKE ``double (*parray[15])[];'' unless it's initialized or external; apparently sys5 converts it to the declaration ``double *(*parray[15]);'' -- ptr to array[15] of (double *) -- automatically. --Brandon -- decvax!cwruecmp!ncoast!allbery ncoast!allbery@Case.CSNET ncoast!tdi2!brandon (ncoast!tdi2!root for business) 6615 Center St. #A1-105, Mentor, OH 44060-4101 Phone: +01 216 974 9210 CIS 74106,1032 MCI MAIL BALLBERY (part-time) PC UNIX/UNIX PC - which do you like best? See <1129@ncoast.UUCP> in net.unix.