Non-Constant Aggregate Initializer Support; Indexed Initializer Support - Analog Devices VISUALDSP++ 3.5 Manual

C/c++ compiler and library for adsp-219x processors
Hide thumbs Also See for VISUALDSP++ 3.5:
Table of Contents

Advertisement

void foo (int n)
()
{
char c[n];
n = 50;
printf("%d", sizeof(c));
}

Non-Constant Aggregate Initializer Support

The compiler includes extended support for aggregate initializers. The
compiler does not require the elements of an aggregate initializer for an
automatic variable to be constant expressions. The following example
shows an initializer with elements that vary at run time:
void initializer (float a, float b)
{
float the_array[2] = { a-b, a+b };
}
All automatic structures can be initialized by arbitrary expressions involv-
ing literals, previously declared variables and functions.

Indexed Initializer Support

ISO/ANSI Standard C and C++ requires the elements of an initializer to
appear in a fixed order, the same as the order of the elements in the array
or structure being initialized. The
ports labeling elements for array initializers. This feature lets you specify
array or structure elements in any order by specifying the array indices or
structure field names to which they apply. All index values must be con-
stant expressions, even in automatic arrays.
For an array initializer, the syntax
element value specifies the index to be initialized by that value. Subse-
quent initializer elements are then applied to sequentially following
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
compiler, by comparison, sup-
cc219x
appearing before an initializer
[INDEX]
Compiler
1-87

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?

Questions and answers

Related Products for Analog Devices VISUALDSP++ 3.5

Table of Contents