Hi all,

I am experiencing some strange memory bugs regarding arrays in my TinyOS 
application. Here is an example:

uint32_t arr[6][3]; //global var

void setter()
{
arr[1][2] = 34;
}

uint32_t getterA()
{ 
return arr[1][2];//34
}
uint32_t getterB()
{ uint8_t a = 1; uint8_t b = 2;
return arr[a][b];//0
}
uint32_t getterC()
{ uint8_t a = 1; uint8_t b = 2; uint32_t *temp;
temp = &(arr[a][b]);
return *temp;//34
}
bool adrEqual()

{ uint8_t a = 1; uint8_t b = 2;
return &(arr[1][2]) == &(arr[a][b]);//true
}

So when I call setter() and then one of the getters, I get the given values. 
The problem is of course getterB. I currently fixed this by using the 
workaround of getterC, but I would prefer fixing the problem and not just the 
symptoms. So if anyone has an idea what may cause this strange behavior I would 
be very thankful if he would share this with me.

Best regards
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to