Technical Support

C51: WARNING 259 (POINTER: DIFFERENT MSPACE)


Information in this article applies to:

  • C51 Version 5.50

SYMPTOMS

I have a pointer that points to a variable in xdata and I am reassigning it to point to a variable in idata. The compiler is giving me

WARNING 259: POINTER: DIFFERENT MSPACE

RESOLUTION

When you reassign a pointer to point to a different memory space, you must cast the address of the variable to the memory space of the pointer. When you then wish to alter the variable via the pointer, you must cast the pointer to the memory space of the variable. For example:

unsigned char idata bar = 2;
unsigned char xdata *ptr;

ptr = (unsigned char xdata *) &bar;
*(unsigned char idata *)ptr = 3;    // bar = 3

MORE INFORMATION

Last Reviewed: Friday, July 15, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure