This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Array with Fully-Bracketed Initializers

Following on from this discussion:
http://www.8052.com/forum/read.phtml?id=84814


Keil C51 v7.50 rejects the following:

char key_tbl[][] =
{
    {   4,   3,   2,   1 },    // row 0
    {   8,   7,   6,   5 },    // row 1
    {  12,  11,  10,   9 },    // row 2
    {  16,  15,  14,  13 },    // row 3
};
It says:
MAIN.C(27): error C163: 'key_tbl': unknown array size
Since this is a Fully-Bracketed Initializer, shouldn't the compiler be able to deduce the size?

The description of this message in the online help doesn't mention this situation:

"In general, a formal size specifier is not required for external, single, or multi-dimensional arrays. Typically, the compiler calculates the size at initialization time. For external arrays, the size is of no great interest. This error is the result of attempting to use the sizeof operator on an undimensioned array or on a multi-dimensional array with undefined element sizes."

0