Gregg Woodcock <[EMAIL PROTECTED]> wrote:
> John Marshall <[EMAIL PROTECTED]> wrote:
>> 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).
The text I quoted is actually from paragraph 14, which is in the part that
does apply to aggregates (as is obvious from the quote). Mea culpa. (The
same text appears as paragraph 14 in the FDIS you refer to.)
> #17 on page 138 of the PDF (page 126 of the document) says this:
> Each brace-enclosed initializer list [...]
>
> The key word is "list". [...] A list is essentially synonymous with
> an array.
What evidence do you have for this last statement about lists and arrays?
(Please quote chapter and verse from the FDIS.)
Consider that 6.1/2 says "initializer list" in the main text corresponds
to the "<initializer-list>" nonterminal in the grammar in paragraph 1,
thus strongly suggesting that "list" in the main text is merely an
informal term referring to the syntax.
> #20 is more our case and it says this:
> If the aggregate or union contains elements or members that ar aggregates
> or unions [...]
(The aggregate in question is "const char threeChars[]" and it does not
contain any aggregate/union elements.)
This part of this thread started by trying to determine whether the
difference between the following definitions constituted Gregg's
essential problem:
static const char threeChars[] = {"123"};
static const char threeChars[] = "123";
It seems to me that the interesting thing to note here is that the
initializer has no effect on the type of the object being defined:
it's all determined to the left of the "=". Even if the values of
the two arrays differed, it would be surprising if that caused the
particular problem Gregg saw. Therefore it should be clear that this
minor syntactic difference isn't the essential problem.
On the other hand, it's no surprise that
static const char *threeChars = "123";
affects the essential problem, because the type of the object being
defined is different.
In fact, it turns out that, for historical reasons, you have a surprising
amount of leeway with braces in initializers -- see the examples after
section 6.7.8. So the values of the two arrays above are indeed the same.
This may well be an interesting discussion. But probably not here on
palm-dev-forum :-)
John
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/