"John Marshall" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Gregg Woodcock <[EMAIL PROTECTED]> wrote:
> > You said, the 2 different definitions are "entirely different"
> [...]
> > In other words, the 2 are exactly the same
>
> There are *three* definitions under consideration.  One is entirely
> different from the other two.
>
> >> No, it's a single dimensional array.
> >
> > No, it is a 2 dimensional array with a single element.
>
> Hmmm.  I noted my sources (ISO/IEC 9899:1999 6.7.8/11).  What are yours?

Those sections apply to scalars; we are talking about aggregates (arrays).
My refs are here:

http://www.sics.se/~pd/ISO-C-FDIS.1999-04.pdf

#17 on page 138 of the PDF (page 126 of the document) says this:
Each brace-enclosed initializer list [ e.g. {"123"} which is a list of 1
element, exactly as I am claiming ] has an associated current object.  When
no designations are present, subobjects of the durrent object are
initialized in order according to the type of the current object: array
elements in increasing subscript order...

The key word is "list".  Curly braces always indicate a list.  Any list may
have only a single element.  A list is essentially synonymous with an array.

#20 is more our case and it says this:
If the aggregate or union contains elements or members that ar aggregates or
unions [i.e. an array of arrays or, as I put it, a 2 dimensional array], ...
only enough initializers from the list are taken to account for the elements
or members of the subaggregate...

#22 is also relevant and it says this:
If an array of unknown size is initialized, its size is determined by the
largest indexed element with an explicit initializer.  At the end of its
initializer list, the array no longer has incomplete type.

In other words, a two-dimensional array with only 1 element should be
treated by the compiler as a one-dimensional array.  However that does not
mean it IS a one-dimensional array; only that it can be used to initialize
one.



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to