C/C++ Compiler Language Extensions
elements of the array, unless another use of the
The index values must be constant expressions, even if the array being ini-
tialized is automatic.
The following example shows equivalent array initializers—the first ini-
tializer is in ISO/ANSI standard C/C++; the second initializer uses the
compiler.
cc219x
The [index] precedes the value being assigned to that element.
/* Example 1 Standard & cc219x C/C++ Array Initializer */
/* Standard Array Initializer */
int a[6] = { 0, 0, 115, 0, 29, 0 };
/* equivalent cc219x C/C++ array initializer */
int a[6] = { [2] 115, [4] 29 };
You can combine this technique of naming elements with standard C/C++
initialization of successive elements. The standard and
below are equivalent. Note that any unlabeled initial value is assigned to
the next consecutive element of the structure or array.
/* Example 2 Standard & cc219x C/C++ Array Initializer */
/* Standard Array Initializer */
int a[6] = { 0, v1, v2, 0, v4, 0 };
/* equivalent cc219x C/C++ array initializer that uses
indexed elements */
int a[6] = { [1] v1, v2, [4] v4 };
1-88
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
syntax appears.
[INDEX]
instructions
cc219x
for ADSP-219x DSPs
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?
Questions and answers