PRB: Missing Closing ")" in Macro Causes Unexpected EOF (42019)
The information in this article applies to:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 5.0
- Microsoft Visual C++, 32-bit Editions 6.0
This article was previously published under Q42019 SUMMARY
The compiler generates one of the following errors:
C1057 unexpected EOF in macro expansion ( missing ')'? )
fatal error C1057: unexpected end of file in macro expansion
This behavior is by design. It informs the user of a syntax error.
Examine the code line indicated by the compiler error. Ensure that the
macro is used properly with both opening and closing parentheses and all
parameters required.
Sample Code
The following sample code generates the error:
/* Compile options needed: none
*/
#include <stdio.h>
#define add(wx, wy) (wx) + (wy)
void main( )
{
int i;
i = add( 1, 2 );
printf( "i = %d\n", i );
i = add( 1, 2 ; /* missing ')' */
printf( "Hello World\n" );
for( i = 0; i < 10; i++ )
{
printf( "i + 10 = %d\n", add( i, 10 ) );
}
}
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbprb KB42019 kbAudDeveloper |
---|
|