what is the type of initialize list in C++ array?

c, c++

Solution

In C++03 a brace-enclosed initializer is just a syntactic device that can be used to initialize aggregates (such as arrays or certain types of classes or structs). It does not have a 'type' and can only be used for those specific kinds of initializers.

8.5.1/2 "Aggregates":

When an aggregate is initialized the initializer can contain an initializer-clause consisting of a brace- enclosed, comma-separated list of initializer-clauses for the members of the aggregate, written in increasing subscript or member order.

Problem

Code like this can work fine: ``` char str[] = {'a', 'b', '\0'}; ``` The left is an auto variable(array). Code like this can NOT work: ``` char *str = {'a', 'b', '\0'}; ``` The left side is a pointer. The pointer points to an unknown space, so this will fail. My question is, what is the type of the right side? In C++ 11, an initialize list becomes `std::initializer_list`. But what about old C++ 03?

Original source