ID Number: Q50234
5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a
MS-DOS | OS/2
Summary:
When a function name declared in your program is used without
parentheses, the compiler does not produce any code. The compiler may
not produce error messages or warnings as long as the function has
been prototyped. This occurs regardless of whether or not the function
takes parameters because the compiler calculates the function address;
however, because the function call operator "()" is not present, no
call is made. This result is similar to the following:
int a;
a; /* no code generated here either */
In Microsoft C version 5.1, no warnings are generated. In Microsoft C
versions 6.0, 6.0a, and 6.0ax, the following warning is generated on
warning level 4:
warning C4205: statement has no effect
Microsoft C/C++ version 7.0 generates the following warning:
warning C4075: statement has no effect with /W4
More Information:
The sample code below compiles and links correctly without errors but
produces no code in reference to foo(). For this to work correctly,
add the function call operator "()".
Sample Code
-----------
/* Compiler Options needed: /W4( C6.0, C6.0a, and C6.0ax only )
*/
void funcname(int a, int b);
void main(void)
{
funcname; /* Using foo without function call operator () */
}
Additional reference words: 5.10 6.00 6.00a 6.00ax 7.00