bad food in uninitialized data.

Technical questions regarding the XTC tools and programming with XMOS.
Heater
Respected Member
Posts: 296
Joined: Thu Dec 10, 2009 10:33 pm

bad food in uninitialized data.

Post by Heater »

I just made a discovery that surprised me in an odd way.

If you declare an array and then access it before it is initialized you get the hex value 0xbaddf00d.

It was a surprise because I had previously been been initializing the array with the traditional 0xdeadbeef.

At least in XC, in C this did not seem to be so.

Or is it just that stack space is initialized that way?


ale500
Respected Member
Posts: 259
Joined: Thu Sep 16, 2010 9:15 am

Post by ale500 »

It is still bad food... I'd be more worried if it were a babe's face ;-)

From what I see in the xsim trace no initialization is done (there is a short memset call)... so the program in OTP may be initilizing it... did you use xsim to see which value do you get ?