DSPRelated.com
Forums

Re: array initialization on CCS does not work properly? do u know wh

Started by Andrew Nesterov May 11, 2008
> Subject: Re: array initialization on CCS does not work properly? do u know wh
> Posted by: "Jeff Brower" j...@signalogic.com
> Date: Sun May 11, 2008 10:29 am ((PDT))
>
> Ahmad-
>
>> I am working on C6416 DSK. In my source code I have initialized
>> global arrays with zero as follows:x
>> array1[900]={0};
>> array2[6]={0};
>
> The code line:
>
> array2[6] = {0};
>
> is supposed to be integer? Floating-point? Short? Long? What? I don't
> think people can help you if you can't ask a precise question.

And the answer is inside the Section 7.9 of SPRU187n.pdf. A standard (C or C++,
not sure which one precisely) says that an array is initialized all the same
as is the first element, but apparently this is not guaranteed in case of cl6x.
However this behavior is described in SPRU187.

HTH,

Andrew

> -Jeff
>
>> But when I see the content of array2, I see that only the first
>> member is set to zero and other ones are not zero.
>>
>> Another strong problem is that When I used external Emulator
>> (TDS510USB from Wintech Co.), the above initialization results in
>> setting all values of array1 to zero but only first 4 bytes of array2
>> to zero. When I change the order of array1 and array2 in my source
>> code it works properly. Is it the bug of compiler or emulator?
>> How can I set all values of my big arrays?
>