C51 Compiler, 8051 Utilities manuals' examples syntax for 'code' conflict

User's guide, 01.97, C compiler C51 on page 63 'explicitly defined memory types' recommends a syntax.

The Utilities guide, 04.95, page 119, has a different syntax in files c_mess0.c, c_mess1.c.

the utilities guide contradicts the recommendation in the user's guide.

Yet the 'preferred' method in the C51 compiler will NOT work. You must use the 'obsolete' method of the Utilities guide.

(1) Please explain.

(2) What is correct syntax for:
const unsigned char code *MyArray[NumberFruits] = {"apple,"banana","cherry"};

Parents
  • (2) What is correct syntax for:
    const unsigned char code *MyArray[NumberFruits] = {"apple,"banana","cherry"};


    Maybe I'm missing something, but the following code compiles just fine here.

    const unsigned char code *MyArray[] = { "apple", "banana", "cherry" };
    

    Note that I did have to add a quote after apple and I removed NumberFruits from the array index since I didn't know what it was (variable, #define) and what its value was.

    Jon

Reply
  • (2) What is correct syntax for:
    const unsigned char code *MyArray[NumberFruits] = {"apple,"banana","cherry"};


    Maybe I'm missing something, but the following code compiles just fine here.

    const unsigned char code *MyArray[] = { "apple", "banana", "cherry" };
    

    Note that I did have to add a quote after apple and I removed NumberFruits from the array index since I didn't know what it was (variable, #define) and what its value was.

    Jon

Children
More questions in this forum