ARM Technical Support Knowledge Articles

WARNING 259 (POINTER: DIFFERENT MSPACE)

Applies to: C51 C Compiler

Answer


Information in this article applies to:


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

Article last edited on: 2005-07-15 12:18:25

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential