Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!ll-xn!mit-eddie!gatech!gt-eedsp!deb From: deb@gt-eedsp.UUCP Newsgroups: comp.lang.c Subject: Trouble with arrays Message-ID: <40@gt-eedsp.UUCP> Date: Wed, 27-May-87 11:44:24 EDT Article-I.D.: gt-eedsp.40 Posted: Wed May 27 11:44:24 1987 Date-Received: Fri, 29-May-87 01:23:49 EDT Reply-To: deb@gt-eedsp.UUCP (Deb Jackson) Distribution: na Organization: School of Electrical Engineering, Ga. Tech, Atlanta, GA 30332 Lines: 50 Perhaps this is a stupid question, but... If I have a procedure in the same file that it's called from I get the one array dimension as given by 4.3's version of DBX. When I place it in a separate file, DBX reports a different dimension! For example: (same file) #include #define MAXOUTSIZE 318 #define MAXFILTSIZE 62 main() { static float X[MAXOUTSIZE][MAXOUTSIZE]; /* input image */ .../* other decls, etc. */... writearray(X, (dim + L - 1)); } writearray(a, size) float a[MAXOUTSIZE][MAXOUTSIZE]; int size; { /* body */ } (dbx) whatis writearray.a array[0..62] of float *a; If writearray is in another file, with MAXOUTSIZE defined as above: (dbx) whatis writearray.writearray.a array[0..MAXINT] of float *a; ^^^^^^of course, it doesn't say 'MAXINT', but the integer there is indeed MAXINT (unsigned on a Vax 11/780) Neither is correct! In the first, it's too small, in the second it's much greater than necessary. Is this dbx that is messing up, or am I missing the point entirely??? Maybe it's important to mention that I'm running 4.2BSD(BRL)...just have the 4.3 version of dbx since it handles fortran better than the old one. Normally, I wouldn't really care what dbx says, but the printf's in writearray die when malloc'ing in the latter version, so I'm quite sure somethings terribly wrong! [Note: I have checked all the declarations, etc...I know I haven't made a typo along the way.] Thanks for any insight you can offer! Deb Jackson -- Georgia Tech, School of Electrical Engineering, Atlanta, GA 30332 (404)894-3058 uucp: ...!{akgua,allegra,hplabs,ihnp4,seismo,ulysses}!gatech!gt-eedsp!deb internet: deb@dsp.ee.gatech.EDU