Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!amdcad!ames!ncar!tank!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.fortran Subject: Re: An array by any other name. . . Message-ID: <13587@mimsy.UUCP> Date: 16 Sep 88 11:16:26 GMT References: <994@amelia.nas.nasa.gov> <3641@lanl.gov> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 41 In article <3641@lanl.gov> jlg@lanl.gov (Jim Giles) writes: >x[i] and *(x+i) are semantically equivalent in C. (good so far) >I don't _want_ them to be. (Well, there is no accounting for taste.) >... With the pointer, I _don't_ want the language to apply any >constraints on where it can point; None at all? C requires that it point to some integer. >with the array I want array bounds checking - that's two different >semantics folks!!! Actually not. You can buy a C compiler (from Sabre) that will do bounds checking. (It does the checking on pointers, too, including on pointers to regions allocated by malloc.) >Furthermore, in C x[i][j] is _supposed_ to be semantically equivalent >to *(*(x+j)+i). Statically allocated 2-d arrays aren't implemented >this way! Ah, but they are. >In order to get a dynamically allocated to behave semantically like >a statically allocated one I have to use a _different_ declaration >syntax. True, but only with a qualifier. This applies to dynamically allocated, dynamically *sized* arrays, which simply do not exist in C. (Neither do they exist in FORTRAN.) Also, the C language does not have `conformant' (dynamically sized, who-cares-how allocated) arrays, which makes dealing with multidimensional array arguments unnecessarily painful. *This* is the only thing FORTRAN has here that C does not. (It *is* a rather large thing.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris