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

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
  • Yes you can have two mem. space qualifiers. However I believe for future compatibility we are supposed to write the definitions thusly:

    // Pointer is in data space but points back to code space.
    char code * data pToCodeChar; 
    
    // Pointer is in code but points back to idata space.
    char idata * code pToIdataChar; 
    
    // Pointer in xdata but points back to default memory space (typically data, small model).
    char * xdata pToDefaultChar;
    
    // Pointer in default memory model but points to pdata.
    char pdata *pToPdataChar;
    I think you get the idea.

    - Mark

Reply
  • Yes you can have two mem. space qualifiers. However I believe for future compatibility we are supposed to write the definitions thusly:

    // Pointer is in data space but points back to code space.
    char code * data pToCodeChar; 
    
    // Pointer is in code but points back to idata space.
    char idata * code pToIdataChar; 
    
    // Pointer in xdata but points back to default memory space (typically data, small model).
    char * xdata pToDefaultChar;
    
    // Pointer in default memory model but points to pdata.
    char pdata *pToPdataChar;
    I think you get the idea.

    - Mark

Children