Sign in

username:

password:



Not a member?

Search rabbit-semi



Search tips

Subscribe to rabbit-semi



Ads

Discussion Groups

Discussion Groups | Rabbit-Semi | Erroneous pointer assignment

This is a group for folks designing and programming embedded systems using the Rabbit Semiconductor C-programmable microcontroller. Rabbit Semi is a spin-off from Z-World who makes a variety of embedded modules and tools. This group is not affiliated with either Rabbit or Z-World, but is a user forum for sharing ideas, asking questions, flaunting knowledge, and other typical user group stuff. The Rabbit is a powerful uC, supported by a full-featured C-compiler.

Erroneous pointer assignment - Arman Rashid - Jun 19 13:14:35 2008

Hi All,
My application is generating an "Erroneous pointer assignment" error while debugging. An example code is shown below:

typedef struct{
char strName[32];
char strModel[32];
......
int nCount;
int nNodeID;
......
}Device;

int initDevice( Device * d, char *name,int c, int id ....){
....
...
sprintf(d->strName, "%s",name);
...
d->nCount = c;
...
}

main(){
Device d;
....
initDevice(&d,"TX1-12",2,101,....);
.....
}

I am receiving the error inside the initDevice function on line " d->nCount = c; ", I also tried " (*c).nCount = c" and received the same error. Moreover after executing "sprintf(d->strName, "DEVICE NAME"); " the strName valued is not changing.

I should mention that the structure Device is huge (almost 32 kilo byte). It seems like no matter how I try to change the uninitialized contents of the structure after the structure instantiation, nothing changes.

I modified the code and compiled it in Visual Studio platform and received the desired result, but every time I try it on my Rabbit 2000 core it fails with the same error.

What am I doing wrong? Any idea?

Thanks in advance to everyone.
Arman



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )