INF: Cannot Define Other Preprocessor Directives with #define

ID Number: Q38291

4.00 5.00 5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

The Microsoft C Compiler versions 5.0, 5.1, 6.0, 6.0a, 6.0ax, and

C/C++ version 7.0 do not allow a "#define" statement to define another

preprocessor directive. Although the preprocessor output option (/P or

/E) generates the desired expansion, the Microsoft C Compiler

generates the following error messages when compiling the code below:

error C2014: preprocessor command must start as first non-whitespace

error C2054: expected '(' to follow 'define'

error C2061: syntax error : identifier 'MAX'

More Information:

The following code demonstrates the problem:

Sample Code

-----------

/* Compile options needed: none

*/

#define A( x ) x##define MAX 100

A( # )

/*

Preprocessor output expands A( # ) to be:

#define MAX 100

*/

char w[ MAX ];

void main(void);

void main()

{

w[ 0 ] = w[ MAX ];

}

Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00