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

why can't const array be in

const char anarray[5]={1,3,5,7,9};

The above works well. But occupies a lot of mem.




const char code anarray[5]={1,3,5,7,9};

Compliled and linked without an error prompt. But works bad.

Parents
  • Storage Class is a Keil 'C' language extension:
    specifies where an object is to be located; viz, code, data, idata, pdata, or xdata.
    You can specify a Storage Class independently for each identifier in your program.

    Model (or, more precisely, "Memory Model") is a Keil Compiler option. It defines a default Storage Class (and a few other things) for your program; ie, if you don't explicitly state the Storage Class in a definition, the compiler will automatically use the default specified by the Memory Model, viz:
    Small - data;
    Medium - pdata;
    Large - xdata.

    It's all in the C51 User' Guide (C51.pdf), accessible from the 'Books' tab in the uVision Project window.

Reply
  • Storage Class is a Keil 'C' language extension:
    specifies where an object is to be located; viz, code, data, idata, pdata, or xdata.
    You can specify a Storage Class independently for each identifier in your program.

    Model (or, more precisely, "Memory Model") is a Keil Compiler option. It defines a default Storage Class (and a few other things) for your program; ie, if you don't explicitly state the Storage Class in a definition, the compiler will automatically use the default specified by the Memory Model, viz:
    Small - data;
    Medium - pdata;
    Large - xdata.

    It's all in the C51 User' Guide (C51.pdf), accessible from the 'Books' tab in the uVision Project window.

Children
No data