Logical expressions, Functions, Function arguments – Altera Nios II C2H Compiler User Manual

Page 128: Composite types (section 6.2.7)

Advertising
background image

7–4

9.1

Altera Corporation

Nios II C2H Compiler User Guide

November 2009

Language

The following example, which passes the address of

a

as the argument to

the function

analyze()

, is not supported:

void foo()

{

int a=0;

int c=analyze(&a);

}

int analyze( int * p );

You can substitute the following code, which initializes the pointer
outside of the accelerator:

int *pa = &a;

int foo()

{

return analyze(pa);

}

int analyze( int * p );

Logical Expressions

All expressions in logical operations are evaluated. The parser does not
stop evaluation if the first expression of a compound statement is true.

For example, in the following statement, both

i

and

j

decrement, even if

i

is nonzero:

if (i-- || j--)

In the following code fragment, the C2H Compiler evaluates the divide
by 0, which causes an error:

int i = 2 || 1 / 0 ;

Functions

The following sections list restrictions on functions.

Function Arguments

This section lists restrictions on arguments to functions.

Composite Types (Section 6.2.7)
The C2H Compiler does not support function arguments of different but
compatible types in function declarations that refer to the same entity.

Advertising