 |
|
 |
RENESAS TOOL NEWS on November 16, 2003: RSO-M3T-NC308WA_2-031116D
A Note on Using C compilers
M3T-NC308WA and M3T-NC30WA
--On Declaring Parameters in Function Definitions--
|
Please take note of the following problem in using the M3T-NC308WA and M3T-NC30WA C compilers (with an assembler and integrated development environment):
- On declaring parameters in function definitions
- Products and Versions Concerned
-
- M3T-NC308WA V.5.10 Release 1
for the M32C/80 and M16C/80 series
- M3T-NC30WA V.5.10 Release 1 and V.5.20 Release 1
for the M16C/60, M16C/30, M16C/Tiny, M16C/20, M16C/10, and R8C/Tiny series
- Description
If no identifier (the name of a parameter) is specified at declaring a parameter in a function definition, compiling such a source file causes an application error to arise.
- 2.1 Conditions
- This problem occurs if the following three conditions are satisfied:
| (1) | A function with a parameter passed via a register is defined. |
| (2) | No identifier is appended to the parameter in (1) in a function definition. |
| (3) | None of the optimizing options -O, -O1, -O2, -O3, -O4, -O5, -OR, and -OS is selected. |
- 2.2 Example
-
-----------------------------------------------------------------------
int func(int); /* The 1st parameter is of type int,
so passed via a register */
int func(int) /* Conditions (1) and (2) */
{
return 0;
}
-----------------------------------------------------------------------
- Workaround
Specify an identifier at declaring a parameter in a function definition.
-------------------------------------------------------------------------
int func(int); /* The identifier of a parameter is unnecessary
in a function declaration */
int func(int i) /* The identifier "i" of a parameter is
necessary in a function definition */
{
return 0;
}
-------------------------------------------------------------------------
| NOTICE: | In ANSI C, no identifier can be omitted at declaring a parameter in every function definition except "void" with no parameter. In this case of exception, no identifier can be appended. |
- Schedule of Fixing the Problem
We plan to fix this problem in our next release of the products.
|
 |