C
Christian Christmann
Hi,
in a benchmark I've found an uncommon use of a function.
This is the simplified form:
1 int foo( int f )
2 {
3 return f;
4 }
5
6 int main( void )
7 {
8 int a, b, foo();
9 a = 10;
10 b = foo( a );
11
12 return 0;
13 }
I don't understand the use of function "foo" in line 8.
What's it's purpose? It's called without assigning it's
return value to any variable. Furthermore, I wonder
why this function use is allowed at all. According to
the function prototype "foo" expects an integer argument
that is in line 8 not given. Compiling the code with
"gcc -Wall -ansi" does not issue any warning/errors.
Could you shed some light on that.
Regards,
Chris
in a benchmark I've found an uncommon use of a function.
This is the simplified form:
1 int foo( int f )
2 {
3 return f;
4 }
5
6 int main( void )
7 {
8 int a, b, foo();
9 a = 10;
10 b = foo( a );
11
12 return 0;
13 }
I don't understand the use of function "foo" in line 8.
What's it's purpose? It's called without assigning it's
return value to any variable. Furthermore, I wonder
why this function use is allowed at all. According to
the function prototype "foo" expects an integer argument
that is in line 8 not given. Compiling the code with
"gcc -Wall -ansi" does not issue any warning/errors.
Could you shed some light on that.
Regards,
Chris