
Altera Corporation 9.1 7–7
November 2009 Nios II C2H Compiler User Guide
ANSI C Compliance and Restrictions
Function Prototypes (Section 6.9.1, Paragraph 14)
A function prototype cannot be encapsulat
ed within a function.
For example, the following code is not supported:
void doDMA(int a)
{
void analyze(int i);
...
}
The C2H Compiler supports separate declarations of functions, as
follows:
void analyze(int i);
void doDMA(int a)
{
...
}
Recursive Function Calls (Section 6.5.2.2, Paragraph 11)
Recursive function calls are not supported.
Example 7–2 shows an unsupported recursive implementation of the
factorial function.
Example 7–2. Recursive Implementation of Factorial Function
int factorial(int x)
{
if (x>1) return factorial(x-1) * x;
else return x;
}
You can replace recursive functions with equivalent code that
implements the function without using recursion. Example 7–3 shows an
equivalent implementation of the factorial function without using
recursion.
Commenti su questo manuale