Array initialization (section 6.7.8, paragraph 3), Delayed declaration, Expressions – Altera Nios II C2H Compiler User Manual

Page 127

Advertising
background image

Altera Corporation

9.1

7–3

November 2009

Nios II C2H Compiler User Guide

ANSI C Compliance and Restrictions

Array Initialization (Section 6.7.8, Paragraph 3)

Array initialization is supported; however, the array size must be
established before initializing individual elements of the array.

The following code, which assigns a single element of an array without
establishing its size, is not supported:

int a[] = {[5]=2};

The following initialization, which establishes the array size before
initializing a single element, is supported:

int a[6]; /* establish array size */

a[5]=2; /* assign element 5 */

It is also possible to initialize the entire array with a single statement, as
follows:

int a[6]={0,0,0,0,0,2}; /* init a[]*/

int b[]={0,0,0,0,0,2}; /* init b[]*/

Delayed Declaration

The C2H Compiler does not support delayed declaration of variables.

For example, the following code, which first declares an array of
unspecified size and later provides the size, is not supported:

int a[];

int a[20];

You can establish the size of the array when it is declared:

int a[20];

Expressions

The C2H Compiler does not support the following C operators.

Unary Operator (Address Operator) (Section 6.5.3.2, Paragraph 1)

The unary

&

operator used as an address operator is not supported.

Advertising