gdb and g77
Joern Rennecke
amylaar@cygnus.co.uk
Wed Jun 30 15:43:00 GMT 1999
> >> (Yes, it is a "C-ish" back end, but it does have a higher-level array
> >> facility than C itself does, insofar that C cannot represent arrays
> >> of arrays -- instead, it represents arrays of pointers to arrays, for
> >> example.)
> >
> >Huh? C can represent arrays of arrays just fine.
>
> That's news to me. Care to show how? Note I said *represent* -- not
> *implement* -- as any language that provides single-dimensional arrays
> can be used to *implement* multi-dimensional arrays.
>
> So, basically, what I'm asking is, what is the C notation that denotes
> the equivalent to Fortran's
>
> REAL A(5,6)
>
> (except that it's row-major, of course) *including* the fact that the
> storage takes up 30 units of memory *and* the fact that the same array
> declaration works just fine regardless of whether A is a local variable,
> in common (external) storage, or a dummy argument (the last case being
> especially notable)?
You can't have an array argument - not even a one-dimensional one.
The array decays to a pointer to its first element; if you try to pass
an array of arrays of X, you get a pointer to the first array of X.
So, the array is left at the caller site, so to speak, while the callee
has to be content with being able to manipulate all elements of the
array via the passed pointer.
(You can of course wrap an array in a struct and pass that,
but that's cheating ;-)
More information about the Gcc
mailing list