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

WARNING C258 mspace ignored

this "extract to show" compiles with the warning. I definitely do not want the overhead from mspace ignored. What am I missing in making this mspace dependent i.e VFcPtr always code.

here void VFDcdatLgt(unsigned char code VFcPtr[], VFcCcnt);
unsigned char code VFinit[]   = {0x1b, 0x40};
unsigned char xdata GCXvfdBuf[40];

void main (void)
{
VFDcdatLgt(VFinit, 2); // in initialize
}  /*- end main -*/

here void VFDcdatLgt(unsigned char code VFcPtr[], VFcCcnt)
{
unsigned char VFDCtemp;

  for ( VFDCtemp = 0 ; VFcCcnt !=0 ; VFDCtemp++, VFcCcnt--)
  {
    GCXvfdBuf[VFDCtemp] = VFcPtr[VFDCtemp];
  }
}

In advance, thanks

Ertik

Parents
  • I imagine it has some thing to do with the following:

    char code *ptr_to_code is a pointer in the default mspace that points to Code space;

    char code * code code_ptr_to_code is a pointer in Code space that also points to Code space.

    char code code_array[] is an array in Code space.
    You can use the name "code_array" as a reference to the location of the array, but it isn't exactly a pointer - it is not a separate variable stored somewhere.

    No doubt it's somewhere in this extra possibility of specifying both the location of a pointer and it's pointed-to mspace that it all falls down?

Reply
  • I imagine it has some thing to do with the following:

    char code *ptr_to_code is a pointer in the default mspace that points to Code space;

    char code * code code_ptr_to_code is a pointer in Code space that also points to Code space.

    char code code_array[] is an array in Code space.
    You can use the name "code_array" as a reference to the location of the array, but it isn't exactly a pointer - it is not a separate variable stored somewhere.

    No doubt it's somewhere in this extra possibility of specifying both the location of a pointer and it's pointed-to mspace that it all falls down?

Children
  • "void func(array[])
    void func(*array)
    are equivalent, the only difference being that one is clearer than the other."


    But, I suspect, the opinion as to which one is the clearer is a subjective one...? ;-)

    Personally, I say the "func(*array)" is clearer as it describes exactly what is actually passed - a pointer - and gives no room for anyone to think that the whole array might actually be passed.

    But I guees that you find "func(array[])" clearer...? ;-)

  • 1)Personally, I say the "func(*array)" is clearer as it describes exactly what is actually passed - a pointer
    2)But I guees that you find "func(array[])" clearer...? ;-)

    1) show what is passed
    2) show what is used

    a proverb "some like the mother, some like the daughter" describes our "argument" rather well.

    Erik