S
Subra
Hi,
Compilation of the below code fails
#define a this1, /* Comma is intentional line 1*/
#define fun( x, y, z) y*x*z/*line 2*/
char this1,b,c;/*line 3*/
int main()/*line 4*/
{
fun(b, a c); /*Comma is leftout intetionaly line 5*/
}/*line 6*/
with errors as below
test.c: In function `main':
test.c:8: error: `fun' undeclared (first use in this function)
test.c:8: error: (Each undeclared identifier is reported only once
test.c:8: error: for each function it appears in.)
If I just change line 1 and line 5 as below it works obviously.
I want to compile the original above code as it is just a snippet of
my project ! Please help.
"#define a this1," to "#define a this1"
"fun(b, a c);" to "fun(b, a, c);" (as below)then it works fine.
#define fun( x, y, z) y*x*z/*line 2*/
char this1,b,c;/*line 3*/
int main()/*line 4*/
{
fun(b, a c);/*line 5*/
}/*line 6*/
Compilation of the below code fails
cat test.c
#define a this1, /* Comma is intentional line 1*/
#define fun( x, y, z) y*x*z/*line 2*/
char this1,b,c;/*line 3*/
int main()/*line 4*/
{
fun(b, a c); /*Comma is leftout intetionaly line 5*/
}/*line 6*/
with errors as below
test.c:8:15: macro "fun" requires 3 arguments, but only 2 givengcc test.c
test.c: In function `main':
test.c:8: error: `fun' undeclared (first use in this function)
test.c:8: error: (Each undeclared identifier is reported only once
test.c:8: error: for each function it appears in.)
If I just change line 1 and line 5 as below it works obviously.
I want to compile the original above code as it is just a snippet of
my project ! Please help.
"#define a this1," to "#define a this1"
"fun(b, a c);" to "fun(b, a, c);" (as below)then it works fine.
#define a this1, /*line 1*/cat test.c
#define fun( x, y, z) y*x*z/*line 2*/
char this1,b,c;/*line 3*/
int main()/*line 4*/
{
fun(b, a c);/*line 5*/
}/*line 6*/